Method and program product for enhanced recognition of small-sized primitives in dot-matrix building cad drawings
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTHEAST UNIV
- Filing Date
- 2026-06-22
- Publication Date
- 2026-08-07
AI Technical Summary
[0004]点阵图格式建筑CAD图纸通常存在如下问题:一是图纸中的线条、圆弧和符号轮廓可能因扫描、压缩或导出分辨率不足而出现断裂、模糊、毛刺和锯齿;二是文字标注、尺寸线、引线、填充区域和其他图元可能与小图元相互重叠,造成局部遮挡;三是阀门、插座、门窗符号、开关符号、消防设施符号、管线端点符号等小尺寸图元通常由少量短线、端点、角点、圆弧或局部符号结构构成,其视觉特征弱,容易在深度网络的下采样过程中丢失;四是不同类别的小尺寸图元在点阵化、压缩或扫描退化后形态相似,仅依赖局部外观容易发生误检;五是点阵图纸缺少矢量实体和图层信息,传统基于CAD对象解析、图层过滤或块定义匹配的方法难以直接适用
[0068] 1. This invention addresses the problem of missing vector entities, layers, and block definitions in raster-format architectural CAD drawings. It recovers line skeletons, endpoints, corner points, text interference, and long line structures from pixel-level images, enabling subsequent recognition processes to be independent of the original CAD vector data.
Smart Images

Figure CN122530700A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to image recognition technology, and more particularly to an enhanced recognition method and program product for small-sized elements in dot matrix architectural CAD drawings. Background Technology
[0002] Architectural CAD drawings are fundamental data for architectural design, construction review, project management, cost analysis, BIM modeling, and digital project management. As the engineering industry becomes increasingly digitalized, automatically identifying elements, components, symbols, and equipment information in architectural drawings has become a crucial technological direction for improving the efficiency of drawing review and project data management.
[0003] In actual engineering data transfer, although design source files are usually in vector CAD format, raster-format architectural CAD drawings still exist extensively in scenarios such as historical archives, bidding materials, construction reviews, cross-unit collaborations, scanning of paper drawings, PDF screenshots, image compression, and photo archiving. Unlike vector CAD drawings, raster-format architectural CAD drawings no longer retain CAD entities, layers, block definitions, line types, coordinate attributes, and object topological relationships, but only present lines, text, symbols, and graphic structures in pixel form.
[0004] Raster-format architectural CAD drawings typically suffer from the following problems: First, lines, arcs, and symbol outlines may appear broken, blurred, jagged, or have burrs due to insufficient scanning, compression, or export resolution. Second, text annotations, dimension lines, leader lines, filled areas, and other elements may overlap with smaller elements, causing local occlusion. Third, small elements such as valves, sockets, door and window symbols, switch symbols, fire protection facility symbols, and pipeline endpoint symbols are usually composed of a few short lines, endpoints, corners, arcs, or local symbol structures, which have weak visual features and are easily lost during the downsampling process of depth networks. Fourth, different categories of small elements have similar shapes after rasterization, compression, or scanning degradation, making it easy to misidentify based solely on local appearance. Fifth, raster drawings lack vector entities and layer information, making traditional methods based on CAD object parsing, layer filtering, or block definition matching difficult to apply directly.
[0005] Existing methods for architectural drawing recognition mainly include template matching, rule-based geometric analysis, convolutional neural network-based object detection, and Transformer-based visual recognition. Template matching relies on fixed symbol templates, making it difficult to adapt to different design firms and drawing styles. Rule-based geometric analysis relies on low-level structures such as line segments, arcs, and intersections, and lacks stability when faced with raster noise and broken lines. While convolutional neural networks possess strong feature learning capabilities, they typically focus more on local visual appearance, and their accuracy in recognizing small-sized primitives needs improvement. Transformers have global modeling capabilities, but when directly applied to raster CAD drawings, they still lack specific design for small-sized primitives, and their accuracy needs further improvement. Summary of the Invention
[0006] To address the problems existing in the prior art, the purpose of this invention is to provide an enhanced recognition method and program product for small-sized elements in dot matrix architectural CAD drawings with higher recognition accuracy.
[0007] To achieve the above-mentioned objectives, the present invention provides the following technical solution:
[0008] An enhanced recognition method for small-sized primitives in raster architectural CAD drawings includes the following steps:
[0009] S1. Perform image enhancement processing on the dot matrix format architectural CAD drawing to be identified, and generate dot matrix structure auxiliary information based on the enhanced drawing image. The dot matrix structure auxiliary information includes line skeleton diagram, endpoint corner diagram, text interference mask and long line structure diagram.
[0010] S2. Based on the enhanced drawing image and the dot matrix structure auxiliary information, extract feature maps of different scales and combine them to form multi-level feature maps;
[0011] S3. Extract initial feature values for multiple candidate primitives based on the multi-level feature map;
[0012] S4. Based on the initial feature values of the candidate primitives, the auxiliary information of the lattice structure, and the semantic relationship of the building engineering, construct a heterogeneous primitive relationship graph;
[0013] S5. Based on the relationship type and relationship strength in the heterogeneous primitive relationship graph, generate a relationship-guided attention bias, and enhance the initial feature values of each candidate primitive based on the relationship-guided attention bias to obtain the relationship-enhanced features of each candidate primitive.
[0014] S6. Based on the size of the candidate primitives, extract the small primitives. Based on the feature maps and dot matrix structure auxiliary information of the small primitives at different scales, generate a small primitive perception attention map. Then, fuse the small primitive perception attention map into the feature maps at different scales to obtain multiple small primitive perception enhancement features at different scales.
[0015] S7. The enhanced features of small-sized primitives and the perception enhancement features of small-sized primitives at all scales are fused to obtain fused features. Based on the fused features and the auxiliary information of the dot matrix structure, occlusion layer prediction is performed on small-sized primitives with the risk of occlusion or incompleteness to obtain the current visible area, occluded area and missing completion area. The fused features of small-sized primitives are then reinforced with structural constraints in combination with the heterogeneous primitive relationship graph.
[0016] S8. Based on the relationship enhancement features of each small-sized primitive, the perception enhancement features of small-sized primitives, and the structural constraint reweighting enhancement features, perform primitive category discrimination and bounding box iterative correction to obtain the category label, bounding box, and confidence of small-sized primitives.
[0017] Furthermore, the lattice structure auxiliary information in step S1 is generated in the following manner:
[0018] S1.1 Perform skeletonization processing on the enhanced drawing image to obtain a line skeleton diagram;
[0019] S1.2 Extract the endpoints, branch points, and corner points of the line skeleton in the line skeleton diagram to obtain the endpoint and corner point diagram;
[0020] S1.3 Extract the text region from the enhanced drawing image to obtain the text interference mask;
[0021] S1.4 Extract the long line structure from the enhanced drawing image and generate a long line structure diagram.
[0022] Furthermore, step S2 specifically includes:
[0023] The enhanced drawing image and the dot matrix structure auxiliary information are input into the basic visual feature extraction network to obtain multiple feature maps of different scales. The feature maps of different scales are superimposed to form a multi-level feature map.
[0024] The basic visual feature extraction network includes a convolutional feature extraction module and a Transformer feature modeling module. The convolutional feature extraction module is used to extract point-type features and line-type features from the enhanced drawing image. The Transformer feature modeling module is used to capture the cross-regional spatial dependencies and layout relationships of point-type features and line-type features based on the point-type features and line-type features, and generate multiple feature maps of different preset scales.
[0025] Furthermore, step S4 specifically includes:
[0026] S4.1. Treat each candidate graphic element as a candidate graphic element node, treat each linear structure in the line skeleton diagram and long line structure diagram as a linear structure node, treat each text interference mask as a text interference node, treat each spatial region in the enhanced drawing image as a region structure node, and all nodes constitute the node set of the heterogeneous graphic element relationship diagram.
[0027] S4.2 For any two nodes in the node set, generate a relationship edge between the nodes based on one or more of the following methods: spatial location, geometric connection, pixel connectivity, directional consistency, region inclusion relationship, and engineering semantic relationship. Extract the geometric features and relationship type encoding of each relationship edge. All relationship edges constitute the edge set of the heterogeneous primitive relationship graph. The relationship types of the relationship edges include connection relationship edges, embedding relationship edges, proximity relationship edges, inclusion relationship edges, and occlusion relationship edges.
[0028] Furthermore, step S5 specifically includes:
[0029] S5.1, regarding the heterogeneous primitive relationship graph, the first... The node and the first Calculate the relationship strength between nodes:
[0030]
[0031] in, Indicates the first The node and the first The strength of the relationship between nodes and The first The node and the first The characteristics of each node For relation edges ( , The geometric features of ) For relation edges ( , Relational type encoding, , , , , , For learnable parameters, For the Sigmoid function, Indicates a splicing operation;
[0032] S5.2 Obtain the mapping relationship between each node in the heterogeneous primitive relationship graph and each image block within the preset window. Based on the relationship strength and mapping relationship, generate the first image block within the preset window. The image patch and the first The relationship between image patches guides attention bias. :
[0033]
[0034] in, Indicates the first The image patch and the first Spatial overlap weight or attribution weight of each node Indicates the first The image patch and the first Spatial overlap weight or attribution weight of each node Represents the set of edges in a heterogeneous graph primitive relationship graph. This represents the scaling factor corresponding to the learnable relation type;
[0035] S5.3, according to Calculate window self-attention:
[0036]
[0037] in, For relative position offset, This indicates the dimensions of the query vector and the key vector. For window mask; These represent the query vector, key vector, and value vector, determined based on the initial feature values of each candidate primitive, respectively. Indicates window self-attention;
[0038] S5.4. Window self-attention is used to enhance the initial feature values of each candidate primitive to obtain the relationship enhancement features of each candidate primitive.
[0039] Furthermore, step S6 specifically includes:
[0040] S6.1 Extract the smaller-sized elements from the candidate elements based on their dimensions;
[0041] S6.2 Extract the lowest-scale feature map from the feature maps of multiple scales of small-sized primitives, and generate a small-sized primitive perceptual attention map using the following formula, together with the line skeleton map, endpoint corner map, and text interference mask:
[0042]
[0043] in, This represents a small-sized primitive-aware attention map. Represents the feature map at the lowest scale. Represents a line skeleton diagram. Represents the endpoint corner point diagram. Indicates text interference mask, This indicates a scale alignment operation. This represents the Sigmoid function. Indicates the convolution operation;
[0044] S6.2. Map the small-size primitive-aware attention map alignment operation to each scale to obtain the small-size primitive-aware attention map for each scale. ;
[0045] S6.3. Fuse the small-scale primitive perception attention map at each scale with the feature maps at each scale to obtain multi-scale small-scale primitive perception enhancement features:
[0046]
[0047] in, This represents the perceptual enhancement feature of small primitives at the k-th scale. This represents the feature map at the k-th scale extracted in step S2. Indicates the first Scale fusion weights for each scale This represents element-wise multiplication. Indicates will Resolution aligned to the 1st A mapping operation of scales, k=1,…,K, where K represents the number of scales.
[0048] Furthermore, step S7 specifically includes:
[0049] S7.1. The relationship enhancement features of each small-sized primitive and the perception enhancement features of small-sized primitives at all scales are fused to obtain the fused features;
[0050] S7.2 Determine whether there is any risk of occlusion or incompleteness in each small-sized graphic element;
[0051] S7.3 For each small primitive with the risk of occlusion or incompleteness, based on its fusion features, the local image of the line skeleton within the small primitive, the local mask of text interference within the small primitive, and the geometric features of the relation edges connected to the candidate primitive nodes corresponding to the small primitive, predict the currently visible area, occluded area, and missing completion area in the small primitive:
[0052]
[0053] in, These represent the enhanced features of the i-th small primitive with the risk of occlusion or incompleteness, the local map of the line skeleton, the local mask of text interference, and the geometric features of the relation edges connected to the corresponding nodes of the small primitive, respectively. These represent the currently visible area, occluded area, and missing completion area of the i-th small-sized primitive, respectively, which are at risk of occlusion or incompleteness. This represents a pre-trained hierarchical occlusion prediction network;
[0054] S7.4. Based on the currently visible primitive region, occluded region, and missing completion region, structural constraints are reweighted on the fusion features of each small primitive with the risk of occlusion or incompleteness:
[0055]
[0056] in, This represents the features after reweighting of structural constraints. , , These are the corresponding weight coefficients; This indicates element-wise multiplication.
[0057] Furthermore, step S8 specifically includes:
[0058] S8.1. The relationship enhancement features, perception enhancement features, and structural constraint reweighting enhancement features of each small-sized primitive are fused together to obtain the joint features of each small-sized primitive.
[0059] S8.2. Based on the joint features, make predictions to obtain the category labels and confidence scores of each small-sized primitive;
[0060] S8.3 Predict the initial bounding box based on the currently visible area of each small-sized primitive;
[0061] S8.4 Based on the joint features, initial bounding box, current visible region and missing completion region, input the pre-trained bounding box correction network, predict the bounding box correction amount, and correct the initial bounding box using the bounding box correction amount to obtain the intermediate bounding box.
[0062] S8.5. Based on the relationship types in the heterogeneous primitive relationship graph, perform geometric consistency correction on the intermediate bounding boxes to obtain the final bounding boxes.
[0063] Furthermore, the parameters used in each step of the calculation are obtained by training with a joint loss function, which is:
[0064]
[0065] Where L is the joint loss, For primitive classification loss, For bounding box regression loss, For small primitive enhancement loss, Predict loss for relation edge types. For relational attention bias constraint loss, To predict loss by occlusion layering, To iteratively correct the loss for the detection boxes, This represents the weight of the corresponding loss.
[0066] A computer program product includes a computer program / instructions that, when executed by a processor, implement the above-described method.
[0067] Compared with the prior art, the beneficial effects of this invention are:
[0068] 1. This invention addresses the problem of missing vector entities, layers, and block definitions in raster-format architectural CAD drawings. It recovers line skeletons, endpoints, corner points, text interference, and long line structures from pixel-level images, enabling subsequent recognition processes to be independent of the original CAD vector data.
[0069] 2. This invention constructs a heterogeneous primitive relationship graph including candidate primitive nodes, linear structure nodes, text interference nodes, and regional structure nodes, which can explicitly model engineering semantic relationships such as doors and windows with walls, valves with pipelines, sockets with walls, stair symbols with stairwells, and fire protection symbols with passages.
[0070] 3. This invention maps the relationship strength in the heterogeneous primitive relationship graph to the relationship-guided attention bias in the window self-attention, so that the visual feature modeling process is constrained by engineering semantic relationships, thereby improving the ability to distinguish small primitives with similar shapes.
[0071] 4. The present invention generates a small-sized primitive perceptual attention map, which can enhance the response of small-sized primitives to lines, endpoints, corners and closed structures, and reduce the loss of detail caused by deep downsampling.
[0072] 5. This invention, through hierarchical prediction of visible areas, occluded areas, and missing completion areas, and by performing structural constraint completion, can restore the complete semantic boundary of the target primitive when it is occluded by text, dimension lines, pipelines, or other primitives.
[0073] 6. This invention is applicable to various architectural engineering drawing scenarios, including historical scanned drawings, PDF screenshots, image-format construction drawings, compressed drawings, photographed drawings, and vector CAD exported bitmaps, and has strong engineering adaptability. Attached Figure Description
[0074] Figure 1 This is a flowchart illustrating the method for enhancing the recognition of small-sized elements in dot matrix architectural CAD drawings provided in this embodiment of the invention.
[0075] Figure 2 This is a schematic diagram of the heterogeneous primitive relationship diagram and the generation of relationship-guided attention bias in this invention;
[0076] Figure 3 This is a schematic diagram of occlusion layer prediction and bounding box iterative correction in this invention. Detailed Implementation
[0077] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0078] Example 1
[0079] This invention provides an enhanced recognition method for small-sized primitives in raster architectural CAD drawings, such as... Figure 1 As shown, it includes the following steps:
[0080] S1. Perform image enhancement processing on the dot matrix format architectural CAD drawing to be identified, and generate dot matrix structure auxiliary information based on the enhanced drawing image.
[0081] The image enhancement process specifically includes inputting raster-format architectural CAD drawings and performing size normalization, grayscale conversion, binarization, noise reduction, local contrast enhancement, line enhancement, and text interference reduction to obtain an enhanced drawing image.
[0082] The dot matrix structure auxiliary information includes a line skeleton diagram, endpoint and corner point diagrams, text interference masks, and long line structure diagrams. The generation steps include:
[0083] S1.1 Perform skeletonization processing on the enhanced drawing image to obtain a line skeleton diagram, which is used to retain the thin lines, short lines, pipelines, wall lines and symbol lines in the bitmap drawing;
[0084] S1.2 Extract the endpoints, branch points, and corner points of the line skeleton in the line skeleton diagram to obtain an endpoint and corner point diagram. Specifically, traverse the 8-neighborhood topology of each skeleton pixel in the line skeleton diagram. When a skeleton pixel is connected to only one skeleton neighbor pixel, it is marked as an endpoint. When a skeleton pixel is connected to three or more skeleton neighbor pixels, it is marked as a branch point. For a skeleton pixel connected to two skeleton neighbor pixels, calculate the angle between its adjacent skeleton directions. When the angle is less than a preset corner point threshold, it is marked as a corner point. Furthermore, the endpoints, corner points, and branch points can be further filtered and aggregated by combining local curvature changes and line segment intersection relationships to generate an endpoint and corner point diagram, which is used to highlight the endpoints, corner points, intersections, and closed structures in small-sized primitives.
[0085] S1.3 Extract text regions from the enhanced drawing image to obtain a text interference mask. Specifically, a text detection model is used to perform preliminary text region detection on the enhanced drawing image to obtain candidate text regions. For connected components not recognized by the detection model, supplementary text region detection is performed based on the aspect ratio, area size, local stroke density, and character arrangement features of the connected components. Furthermore, an OCR model is used to verify the text recognition of the candidate regions, and regions with a recognition confidence greater than a preset threshold are identified as text regions. All identified text regions are merged, expanded, and binarized to generate a text interference mask, which is used to mark text annotations, size numbers, and engineering descriptions that may obscure small graphic elements.
[0086] S1.4 Extract long line structures from the enhanced drawing image and generate long line structure diagrams. Specifically, line segment detection, Hough transform, or skeleton orientation clustering can be used to generate long lines to obtain long line structures, which are used to represent continuous linear structures such as wall lines, pipelines, dimension lines, and drawing boundary lines.
[0087] Using the above method, even if the input drawing does not contain CAD vector entities and layer information, the system can still recover structured auxiliary information from the pixel matrix that can be used for subsequent relationship modeling.
[0088] S2. Based on the enhanced drawing image and the dot matrix structure auxiliary information, extract multiple feature maps of different scales and combine them to form a multi-level feature map.
[0089] Specifically, the enhanced drawing image and the dot matrix structure auxiliary information are input into the basic visual feature extraction network to obtain multiple feature maps at different scales. These feature maps at different scales are then superimposed to form multi-level feature maps.
[0090] The basic visual feature extraction network includes a convolutional feature extraction module and a Transformer feature modeling module. The convolutional feature extraction module is used to extract point-type features and line-type features from the enhanced drawing image. The Transformer feature modeling module is used to capture the cross-regional spatial dependencies and layout relationships of point-type features and line-type features based on the point-type features and line-type features, and generate multiple feature maps of different preset scales.
[0091] Let the enhanced drawing image be:
[0092]
[0093] The auxiliary information of the lattice structure is represented as follows:
[0094]
[0095] in, Represents a line skeleton diagram. Represents the endpoint corner point diagram. Indicates text interference mask, This represents a long-line structure diagram.
[0096] The system performs channel-level stitching or feature-level fusion of the drawing image and the dot matrix structure auxiliary information to obtain the network input:
[0097]
[0098] In this embodiment, the basic visual feature extraction network outputs feature maps at four scales, with downsampling ratios of 4, 8, 16, and 32 relative to the input image, respectively denoted as […]. and , For shallow high-resolution feature layers , and For the middle layer of structure feature layer , For deep semantic feature layer To form multi-level feature maps .
[0099] S3. Extract initial feature values for multiple candidate primitives based on the multi-level feature map.
[0100] The initial feature values for candidate primitives can be achieved by inputting multi-level feature maps into a pre-trained Region Proposal Network (RPN), or generated using dense detection heads, anchor-free detection heads, or query-based detection heads. Candidate primitives include valves, sockets, door and window symbols, stair symbols, fire protection facility symbols, engineering equipment symbols, pipeline endpoint symbols, and switch symbols.
[0101] The initial feature values for each candidate primitive include the candidate bounding box, class prediction probability, scale level, orientation angle, confidence level, visible area proportion, and visual features of the candidate region, which can be represented as:
[0102]
[0103] in, Indicates the center coordinates of the candidate bounding box. and These represent the width and height, respectively. Indicates the aspect ratio. Indicates the direction angle. Indicates scale level, Represents the category prediction probability vector. Indicates the proportion of the visible area. Indicates local visual features, This represents the node feature mapping function.
[0104] S4. Based on the initial feature values of the candidate primitives, the auxiliary information of the lattice structure, and the semantic relationship of the building engineering, construct a heterogeneous primitive relationship graph.
[0105] S4.1. Treat each candidate graphic element as a candidate graphic element node, treat each linear structure in the line skeleton diagram and long line structure diagram as a linear structure node, treat each text interference mask as a text interference node, and treat each spatial region in the enhanced drawing image as a region structure node. All nodes constitute the node set of the heterogeneous graphic element relationship diagram.
[0106] Candidate element nodes correspond to candidate elements such as valves, sockets, door and window symbols, stair symbols, fire protection facility symbols, engineering equipment symbols, pipeline endpoint symbols, and switch symbols. Linear structure nodes correspond to wall lines, pipelines, dimension lines, boundary lines, and other linear structures. Text interference nodes correspond to text interference masks for text annotations, dimension figures, and engineering description text areas. Area structure nodes correspond to spatial areas such as room areas, stairwell areas, equipment areas, passageway areas, and closed graphic areas.
[0107] S4.2 For any two nodes in the node set, generate a relationship edge between the nodes based on one or more of the following methods: spatial location, geometric connection, pixel connectivity, directional consistency, region inclusion relationship, and engineering semantic relationship. Extract the geometric features and relationship type encoding of each relationship edge. All relationship edges constitute the edge set of the heterogeneous primitive relationship graph. The relationship types of the relationship edges include connection relationship edges, embedding relationship edges, proximity relationship edges, inclusion relationship edges, and occlusion relationship edges.
[0108] Architectural drawings typically contain geometric elements with clear engineering semantic relationships. For example, door and window symbols are usually embedded in wall lines or located near wall boundaries; valves are usually connected to pipelines; sockets and switches are usually near walls or room boundaries; fire protection facility symbols are usually located in passageways or around the building perimeter; and pipeline endpoint symbols are usually related to pipeline direction, endpoint location, and connection topology. If these line structures and engineering semantic relationships can be recovered from raster images and incorporated into the visual recognition process, it can effectively assist in the recognition of small-sized geometric elements.
[0109] The relationship edges are generated according to the following rules: when the nearest endpoint distance between the candidate primitive region and the linear structure node corresponding to the wall line or pipeline is less than a preset distance threshold, and the angle between the candidate primitive direction and the linear structure direction is less than a preset angle threshold, a connection relationship edge is generated; when there is boundary overlap, center line coincidence, or the center of the candidate primitive is located within the buffer area of the wall line between the candidate primitive region and the linear structure node corresponding to the wall line, an embedding relationship edge is generated; when the distance between the candidate primitive region and the wall line, room boundary, or pipeline is less than a preset proximity threshold, but there are no explicitly connected pixels, a proximity relationship edge is generated; when the center point of the candidate primitive region is located within the polygon or closed area of the region structure node, an inclusion relationship edge is generated; when the overlap area ratio between the candidate primitive region and text interference nodes, dimension line nodes, pipeline nodes, or other candidate primitive nodes is greater than a preset occlusion threshold, an occlusion relationship edge is generated.
[0110] For example: When a candidate valve node is located near a pipeline node, and the distance from the center of the candidate valve to the pipeline endpoint or the pipeline centerline is less than a threshold, and the direction of the candidate valve meets a preset angle relationship with the pipeline direction, the system establishes a connection edge between the valve and the pipeline. When a candidate door / window node overlaps with a wall line node, or the center of a candidate door / window is located within the buffer area of a wall line, the system establishes an embedding edge between the door / window and the wall. When a candidate socket node is less than the proximity threshold from a wall line or room boundary, the system establishes a proximity edge between the socket and the wall or room boundary. When a candidate stair symbol node is located within a stairwell area node, the system establishes an inclusion edge between the stair symbol and the stairwell area. When the overlap ratio between a candidate graphic element node and a text interference node is greater than an occlusion threshold, the system establishes an occlusion edge.
[0111] The heterogeneous primitive relationship diagram is represented as follows:
[0112]
[0113] in, Represents the set of candidate primitive nodes. Represents a set of nodes in a linear structure. Represents the set of text interference nodes. Represents a set of nodes in a region structure. The set of relation edges is represented; the node features of each candidate primitive node include the candidate primitive center coordinates, candidate primitive width, candidate primitive height, aspect ratio, orientation angle, scale level, category prediction probability, visible area proportion, and local visual features; the node features of each linear structure node include the line segment endpoint coordinates, line segment length, orientation angle, line width, connected component number, structure type probability, and distance from the endpoint of the candidate primitive; the node features of each text interference node include the text region location, text region area, text direction, text confidence, and overlap ratio with the candidate primitive; the node features of each region structure node include the region boundary, region area, region direction, region inclusion relationship, and region type probability.
[0114] Therefore, the system is able to recover the engineering semantic relationships between candidate primitives and between candidate primitives and the drawing structure from a raster image even when CAD vector topology relationships are missing.
[0115] S5. Based on the relationship type and relationship strength in the heterogeneous primitive relationship graph, generate a relationship-guided attention bias, and enhance the initial feature values of each candidate primitive based on the relationship-guided attention bias to obtain the relationship-enhanced features of each candidate primitive.
[0116] Step S5 specifically includes:
[0117] S5.1, regarding the heterogeneous primitive relationship graph, the first... The node and the first Calculate the relationship strength between nodes:
[0118]
[0119] in, Indicates the first The node and the first The strength of the relationship between nodes and The first The node and the first The characteristics of each node For relation edges ( , The geometric features of ) For relation edges ( , Relational type encoding, , , , , , For learnable parameters, For the Sigmoid function, Indicates the splicing operation; edge geometric features It can include:
[0120]
[0121] in, and Indicates the normalized relative position. and Indicates scale differences. Indicates the distance between nodes. Indicates the difference in direction. Indicates the overlap ratio. This indicates the skeleton connectivity strength.
[0122] S5.2 Obtain the mapping relationship between each node in the heterogeneous primitive relationship graph and each image block within the preset window. Based on the relationship strength and mapping relationship, generate the first image block within the preset window. The image patch and the first The relationship between image patches guides attention bias. :
[0123]
[0124] in, Indicates the first The image patch and the first Spatial overlap weight or attribution weight of each node Indicates the first The image patch and the first Spatial overlap weight or attribution weight of each node Represents the set of edges in a heterogeneous graph primitive relationship graph. This represents the scaling factor corresponding to the learnable relation type;
[0125] Wherein, the preset window of the input window's self-attention is set to the first... Each feature layer is The feature layer is divided into several Local windows, each containing The nth image patch; for the nth image patch in the heterogeneous primitive relation graph; Each node, whose corresponding geometric region in the original drawing coordinate system is denoted as . According to the first The scaling ratio of each feature layer relative to the original drawing will Mapped to the Each feature layer coordinate system is used to obtain the projection region. If the first Each image patch corresponds to a region The center point falls into Inside, or the Each image patch corresponds to a region and The overlapping area accounts for the first The proportion of the area of each image patch is not less than a preset overlap threshold. Then it is considered that the first The image patch and the first Establish a mapping relationship between nodes.
[0126] The calculation formula is:
[0127]
[0128] The calculation formula is:
[0129]
[0130] in, Let ε represent the area of the region, and let ε be a minimal constant to prevent the denominator from being zero. A preset overlap threshold is used; preferably, Pick to .
[0131] S5.3, according to Calculate window self-attention:
[0132]
[0133] in, This indicates window self-attention. The relative position offset is obtained through learning. This indicates the dimensions of the query vector and the key vector. The window mask M is obtained based on the window partitioning relationship; for positions where attention interaction is allowed, For locations where attentional interaction is not allowed, . These represent the initial feature values of each candidate primitive. The defined query vector, key vector, and value vector are as follows: in, These are learnable parameters.
[0134] S5.4. Window self-attention is used to enhance the initial feature values of each candidate primitive to obtain the relationship enhancement features of each candidate primitive.
[0135] S6. Based on the size of the candidate primitives, extract the small primitives. Based on the feature maps and dot matrix structure auxiliary information of the small primitives at different scales, generate a small primitive perception attention map. Then, fuse the small primitive perception attention map into the feature maps at different scales to obtain multiple small primitive perception enhancement features at different scales.
[0136] Step S6 specifically includes:
[0137] S6.1 Extract the smaller-sized elements from the candidate elements based on their dimensions;
[0138] The small-sized graphic elements include valves, sockets, door and window symbols, stair symbols, fire protection facility symbols, engineering equipment symbols, pipeline end symbols, switch symbols, elevation symbols, and positioning symbols, etc. The identification method is as follows: for the i-th candidate graphic element, determine whether it is a small-sized graphic element according to the following formula:
[0139]
[0140] in, Indicates the first One candidate primitive was determined to be a small-sized primitive; This represents the area of the candidate bounding box, and ,in and They represent the first The width and height of each candidate bounding box. Indicates logical OR; Indicates the first The area of foreground pixels or skeleton coverage area retained after deducting text interference areas within each candidate bounding box; Indicates the degree of lattice degradation, and ,in Indicates the first The set of foreground pixels in each candidate primitive region This represents the morphological closing operation. To prevent extremely small constants with a denominator of zero; Indicates the degree of line breakage within the candidate primitive, and ,in Indicates the first The number of break points or break segments in each candidate primitive skeleton. Indicates the first Total length of candidate primitive skeletons; and These represent the corresponding thresholds. I() represents the indicator function, where I() = 1 when the condition within the parentheses is true.
[0141] S6.2 Extract the lowest-scale feature map from the feature maps of multiple scales of small-sized primitives, and generate a small-sized primitive perceptual attention map using the following formula, together with the line skeleton map, endpoint corner map, and text interference mask:
[0142]
[0143] in, This represents a small-sized primitive-aware attention map. Represents the feature map at the lowest scale. Represents a line skeleton diagram. Represents the endpoint corner point diagram. Indicates text interference mask, This indicates a scale alignment operation. This represents the Sigmoid function. This represents the convolution operation. Indicates splicing;
[0144] S6.2. Map the small-size primitive-aware attention map alignment operation to each scale to obtain the small-size primitive-aware attention map for each scale. k=1,…,K;
[0145] S6.3. Fuse the small-scale primitive perception attention map at each scale with the feature maps at each scale to obtain multi-scale small-scale primitive perception enhancement features:
[0146]
[0147] in, This represents the perceptual enhancement feature of small primitives at the k-th scale. This represents the feature map at the k-th scale extracted in step S2. Indicates the first Scale fusion weights for each scale This represents element-wise multiplication. Indicates will Resolution aligned to the 1st A mapping operation at each scale makes With the Each scale feature layer With the same spatial resolution and channel dimension, the scale alignment operation can be one or more combinations of upsampling, downsampling, 1×1 convolution, 3×3 convolution and normalization, k=1,…,K, where K represents the number of scales.
[0148] In this way, fine lines, endpoints, corners, and local symbol contours in shallow high-resolution features can be transferred to mid- and deep features, thereby improving the recall rate and localization accuracy of small primitives.
[0149] S7. The enhanced features of small-sized primitives and the perception enhancement features of small-sized primitives at all scales are fused to obtain fused features. Based on the fused features and the auxiliary information of the dot matrix structure, occlusion layer prediction is performed on small-sized primitives with the risk of occlusion or incompleteness to obtain the current visible area, occluded area and missing completion area. The fused features of small-sized primitives are then enhanced by structural constraint reweighting in combination with the heterogeneous primitive relationship graph.
[0150] In raster-format architectural CAD drawings, text annotations, dimension lines, pipe lines, wall lines, or other elements may obscure small-sized elements, resulting in only partial visibility of the target element. Therefore, the system performs occlusion layer prediction on candidate elements that are at risk of occlusion or incompleteness. Step S7 specifically includes:
[0151] S7.1. The relationship enhancement features of each small-sized primitive and the perception enhancement features of small-sized primitives at all scales are fused to obtain the fused features; the fusion can be achieved by stitching.
[0152] S7.2 Determine whether there is any risk of occlusion or incompleteness in each small-sized graphic element.
[0153] Judge based on at least two of the following conditions. If two or more conditions are met, it is determined whether a small-sized graphic element is at risk of occlusion or incompleteness.
[0154] 1. The overlap ratio between the candidate primitive region and the text interference mask is greater than the preset threshold;
[0155] 2. The length or number of breaks in the line skeleton within the candidate primitive area exceeds a preset threshold;
[0156] 3. The difference between the number of endpoints at the boundary of the candidate primitive region and the number of endpoints of the preset symbol structure is greater than the preset threshold;
[0157] 4. The overlap ratio between the candidate primitive region and linear structure nodes or other candidate primitive nodes is greater than the preset threshold.
[0158] 5. The change in the center offset, width and height offset, or category confidence of the candidate primitive in the detection results at different scales is greater than the preset threshold;
[0159] 6. The ratio of the area of the effective visible region of the candidate primitive to the area of the candidate bounding box is less than the preset threshold.
[0160] S7.3 For each small primitive with the risk of occlusion or incompleteness, based on its fusion features, the local image of the line skeleton within the small primitive, the local mask of text interference within the small primitive, and the geometric features of the relation edges connected to the candidate primitive nodes corresponding to the small primitive, predict the currently visible area, occluded area, and missing completion area in the small primitive:
[0161]
[0162] in, These represent the enhanced features, line skeleton local map, text interference local mask, and geometric features of the relation edges connected to the corresponding nodes of the small-sized primitives, respectively, which are at risk of occlusion or incompleteness. The line skeleton local map and the text interference local mask are the local maps corresponding to the candidate primitive regions on the line skeleton map and the text interference mask within the small-sized primitives. Let each represent the currently visible region, occluded region, and missing completion region of the i-th candidate primitive that is at risk of occlusion or incompleteness. This represents a pre-trained occlusion hierarchical prediction network, comprising a shared feature encoding branch and three parallel prediction heads. The three parallel prediction heads are used to predict the currently visible region, the occluded region, and the missing completion region, respectively. The missing completion region is affected by the... Constraints related to the connection, embedding, or proximity relationships of each candidate primitive cause the missing completion region to extend along the direction of the connected linear structure, the direction of symbol symmetry, or the direction of the candidate primitive structure template.
[0163] S7.4. Based on the currently visible primitive region, occluded region, and missing completion region, structural constraints are reweighted on the fusion features of each candidate primitive with occlusion or incompleteness risk:
[0164]
[0165] in, This represents the features after reweighting of structural constraints. , , These are the corresponding weight coefficients; This represents element-wise multiplication. And... and Greater than 0, Greater than or equal to 0; through the structural constraint reweighting, the feature response of the visible area and the missing completion area of the target primitive is enhanced, while the feature response of the occluded area is weakened, thereby providing more complete primitive features for primitive category discrimination and detection box iterative correction in the subsequent step S8.
[0166] S8. Based on the relationship enhancement features of each small-sized primitive, the perception enhancement features of small-sized primitives, and the structural constraint reweighting enhancement features, perform primitive category discrimination and bounding box iterative correction, and output the category label, bounding box, and confidence score of the small-sized primitives.
[0167] Step S8 specifically includes:
[0168] S8.1. The relationship enhancement features, perception enhancement features, and structural constraint reweighting enhancement features of each small-sized primitive are fused together to obtain the joint features of each small-sized primitive. ;
[0169]
[0170] in, This represents a relational enhancement feature representing a small primitive i. This represents a small-size primitive perceptual enhancement feature for small-size primitive i. This represents a linear mapping, a convolutional mapping, or a multilayer perceptron mapping. Indicates splicing operation
[0171] S8.2. Based on the joint features, make predictions to obtain the category labels and confidence scores of each small-sized primitive;
[0172] Specifically, to obtain the first The predicted probabilities of each candidate primitive belonging to its respective candidate category:
[0173]
[0174] in, and The learnable parameters of the classification head are used; the category with the highest predicted probability is taken as the first... Predicted category labels for small-sized primitives ,Right now:
[0175]
[0176] The maximum predicted probability is used as the corresponding category confidence score, or it is combined with the bounding box quality score to form the final confidence score.
[0177] S8.3 Predict the initial bounding box based on the currently visible area of each small-sized primitive;
[0178] Specifically, for Extracting the minimum bounding rectangle of the foreground region And perform boundary expansion by combining the prior aspect ratio or boundary expansion coefficient of the corresponding primitive category to obtain the first Initial bounding box of small primitives:
[0179]
[0180] in, Indicates the first The expansion coefficient corresponding to the class primitive.
[0181] S8.4 Based on the joint features, initial bounding box, current visible region and missing completion region, input the pre-trained bounding box correction network, predict the bounding box correction amount, and correct the initial bounding box using the bounding box correction amount to obtain the intermediate bounding box.
[0182] Bounding box correction and middle bounding box for:
[0183]
[0184]
[0185] in, This includes the bounding box center coordinate offset, as well as the width and height scaling. This indicates the operation of converting the offset and scaling values into corrected bounding box coordinates. () indicates a bounding box correction network, which is a regression network composed of convolutional layers, fully connected layers, or multilayer perceptrons, used to output the center coordinate offset and width and height scaling of the bounding box.
[0186] S8.5. Based on the relationship types in the heterogeneous primitive relationship graph, perform geometric consistency correction on the intermediate bounding boxes to obtain the final bounding boxes;
[0187] Specifically, the geometric consistency correction amount is:
[0188]
[0189] Final bounding box :
[0190]
[0191] in, In a heterogeneous primitive relationship graph, the relationship between the first and second primitives is represented by the first primitive. Features of the relationships between candidate primitives Represents the set of adjacent nodes The geometric consistency correction function It is used to further correct the position, size, or orientation of the bounding box based on the engineering semantic relationship between the candidate elements and wall lines, pipelines, area boundaries, or adjacent candidate elements, so that the final bounding box is consistent with the structural relationship in the drawing.
[0192] The learnable parameters, matrices, and network parameters used in the calculations of the above steps are obtained by training with a joint loss function. for:
[0193]
[0194] in, For primitive classification loss, For bounding box regression loss, For small primitive enhancement loss, Predict loss for relation edge types. For relational attention bias constraint loss, To predict loss by occlusion layering, The loss is iteratively corrected for the detection boxes. This represents the weight of the corresponding loss.
[0195] Primitive classification loss Used to supervise candidate primitive category prediction, it is represented as:
[0196]
[0197] Where N represents the number of primitives participating in the training. Indicates the first The primitive belongs to the first The true label of the class primitive, Indicates the first The probability that a primitive is predicted to be a primitive of class c. Bounding box regression loss. Used to supervise candidate bounding box localization, it is represented as:
[0198]
[0199] in, Indicates the first The regression value of the predicted bounding box of each primitive. This represents the true bounding box regression value. Indicates the predicted bounding box. Represents the true bounding box. Indicates the balance coefficient. Small-size primitive enhancement loss. The constraint used to maintain consistency between the perceptual attention of small primitives and the real-world regions of small primitives is represented as follows:
[0200]
[0201] in, This represents a set of small-sized primitive samples. Indicates the number of small-sized primitive samples. Indicates the first Enhanced attention maps of small primitives Indicates the first The true region mask of a small primitive. Relationship edge type prediction loss. Used for supervising the prediction of relation edge types in heterogeneous primitive relation graphs, it is represented as:
[0202]
[0203] in, This represents the total number of relation edges. Indicates the first The node and the first The edge relating the nodes belongs to the node. The true label of class relationship, This represents the predicted probability. It relates to the attention bias constraint loss. To constrain semantically relevant regions of engineering to have a higher relation-guided attention bias, it is represented as:
[0204]
[0205] Where |P| represents the number of image patch pairs participating in the constraint. Represents truly related image patch pairs. This represents pairs of truly unrelated image patches. Represents the interval constant. and These represent the relationships between corresponding image patch pairs that guide attention bias. Occlusion-layered prediction loss. The prediction results used to supervise the visible region, occluded region, and missing completion region of the target primitive are represented as follows:
[0206]
[0207] in, These represent the visible region, occluded region, and missing completion region of the predicted target primitives, respectively. , and These represent the corresponding real masks. This represents the binary cross-entropy loss. express Loss. Iterative correction of the detection box loss. Used to monitor the bounding box correction results in each round, it is represented as follows:
[0208]
[0209] in, This represents the loss weight corresponding to the t-th round of correction. Indicates the first Round prediction of bounding box correction amount, This represents the correction amount of the true bounding box in round t. This represents the predicted bounding box in round t. The true bounding box is represented. Through the aforementioned joint loss function, primitive category discrimination, bounding box localization, small-sized primitive enhancement, heterogeneous relationship modeling, occlusion layer prediction, and detection box iterative correction can be jointly optimized simultaneously, thereby improving the recognition accuracy, recall rate, and boundary localization precision of small-sized primitives in complex raster architectural CAD drawings.
[0210] For training annotations of occlusion layer prediction, manual annotation can be used, or pseudo-annotations can be generated based on text detection areas, dimension line areas, line break areas, and primitive structure templates.
[0211] For relational edge types, supervision labels can be generated based on drawing annotations, engineering rules, spatial geometric relationships, and pixel connectivity relationships.
[0212] Example 2
[0213] This invention also provides a computer program product, such as an app on a mobile phone or tablet, or an installer on a computer. This product includes a computer program / instructions that, when executed by a processor, implement the method described in Embodiment 1. The code for the computer-executable program used to perform the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0214] It should be understood that the embodiments and descriptions above are only the principles, main features and advantages of the present invention. Various changes and modifications can be made to the present invention without departing from the spirit and scope of the invention, and all such changes and modifications fall within the protection scope of the present invention.
Claims
1. A method for enhanced recognition of small-sized primitives in raster architectural CAD drawings, characterized in that, Includes the following steps: S1. Perform image enhancement processing on the dot matrix format architectural CAD drawing to be identified, and generate dot matrix structure auxiliary information based on the enhanced drawing image. The dot matrix structure auxiliary information includes line skeleton diagram, endpoint corner diagram, text interference mask and long line structure diagram. S2. Based on the enhanced drawing image and the dot matrix structure auxiliary information, extract feature maps of different scales and combine them to form multi-level feature maps; S3. Extract initial feature values for multiple candidate primitives based on the multi-level feature map; S4. Based on the initial feature values of the candidate primitives, the auxiliary information of the lattice structure, and the semantic relationship of the building engineering, construct a heterogeneous primitive relationship graph; S5. Based on the relationship type and relationship strength in the heterogeneous primitive relationship graph, generate a relationship-guided attention bias, and enhance the initial feature values of each candidate primitive based on the relationship-guided attention bias to obtain the relationship-enhanced features of each candidate primitive. S6. Based on the size of the candidate primitives, extract the small primitives. Based on the feature maps and dot matrix structure auxiliary information of the small primitives at different scales, generate a small primitive perception attention map. Then, fuse the small primitive perception attention map into the feature maps at different scales to obtain multiple small primitive perception enhancement features at different scales. S7. The enhanced features of small-sized primitives and the perception enhancement features of small-sized primitives at all scales are fused to obtain fused features. Based on the fused features and the auxiliary information of the dot matrix structure, occlusion layer prediction is performed on small-sized primitives with the risk of occlusion or incompleteness to obtain the current visible area, occluded area and missing completion area. The fused features of small-sized primitives are then reinforced with structural constraints in combination with the heterogeneous primitive relationship graph. S8. Based on the relationship enhancement features of each small-sized primitive, the perception enhancement features of small-sized primitives, and the structural constraint reweighting enhancement features, perform primitive category discrimination and bounding box iterative correction to obtain the category label, bounding box, and confidence of small-sized primitives.
2. The enhanced recognition method for small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, The lattice structure auxiliary information in step S1 is generated in the following manner: S1.1 Perform skeletonization processing on the enhanced drawing image to obtain a line skeleton diagram; S1.2 Extract the endpoints, branch points, and corner points of the line skeleton in the line skeleton diagram to obtain the endpoint and corner point diagram; S1.3 Extract the text region from the enhanced drawing image to obtain the text interference mask; S1.4 Extract the long line structure from the enhanced drawing image and generate a long line structure diagram.
3. The enhanced recognition method for small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, Step S2 specifically includes: The enhanced drawing image and the dot matrix structure auxiliary information are input into the basic visual feature extraction network to obtain multiple feature maps of different scales. The feature maps of different scales are superimposed to form a multi-level feature map. The basic visual feature extraction network includes a convolutional feature extraction module and a Transformer feature modeling module. The convolutional feature extraction module is used to extract point-type features and line-type features from the enhanced drawing image. The Transformer feature modeling module is used to capture the cross-regional spatial dependencies and layout relationships of point-type features and line-type features based on the point-type features and line-type features, and generate multiple feature maps of different preset scales.
4. The enhanced recognition method for small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, Step S4 specifically includes: S4.
1. Treat each candidate graphic element as a candidate graphic element node, treat each linear structure in the line skeleton diagram and long line structure diagram as a linear structure node, treat each text interference mask as a text interference node, treat each spatial region in the enhanced drawing image as a region structure node, and all nodes constitute the node set of the heterogeneous graphic element relationship diagram. S4.2 For any two nodes in the node set, generate a relationship edge between the nodes based on one or more of the following methods: spatial location, geometric connection, pixel connectivity, directional consistency, region inclusion relationship, and engineering semantic relationship. Extract the geometric features and relationship type encoding of each relationship edge. All relationship edges constitute the edge set of the heterogeneous primitive relationship graph. The relationship types of the relationship edges include connection relationship edges, embedding relationship edges, proximity relationship edges, inclusion relationship edges, and occlusion relationship edges.
5. The enhanced recognition method for small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, Step S5 specifically includes: S5.1, regarding the heterogeneous primitive relationship graph, the first... The node and the first Calculate the relationship strength between nodes: , in, Indicates the first The node and the first The strength of the relationship between nodes and The first The node and the first The characteristics of each node For relation edges ( , The geometric features of ) For relation edges ( , Relational type encoding, , , , , , For learnable parameters, For the Sigmoid function, Indicates a splicing operation; S5.2 Obtain the mapping relationship between each node in the heterogeneous primitive relationship graph and each image block within the preset window. Based on the relationship strength and mapping relationship, generate the first image block within the preset window. The image patch and the first The relationship between image patches guides attention bias. : , in, Indicates the first The image patch and the first Spatial overlap weight or attribution weight of each node Indicates the first The image patch and the first Spatial overlap weight or attribution weight of each node Represents the set of edges in a heterogeneous graph primitive relationship graph. This represents the scaling factor corresponding to the learnable relation type; S5.3, according to Calculate window self-attention: , in, For relative position offset, This indicates the dimensions of the query vector and the key vector. For window mask; These represent the query vector, key vector, and value vector, determined based on the initial feature values of each candidate primitive, respectively. Indicates window self-attention; S5.
4. Window self-attention is used to enhance the initial feature values of each candidate primitive to obtain the relationship enhancement features of each candidate primitive.
6. The enhanced recognition method for small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, Step S6 specifically includes: S6.1 Extract the smaller-sized elements from the candidate elements based on their dimensions; S6.2 Extract the lowest-scale feature map from the feature maps of multiple scales of small-sized primitives, and generate a small-sized primitive perceptual attention map using the following formula, together with the line skeleton map, endpoint corner map, and text interference mask: , in, This represents a small-sized primitive-aware attention map. Represents the feature map at the lowest scale. Represents a line skeleton diagram. Represents the endpoint corner point diagram. Indicates text interference mask, This indicates a scale alignment operation. This represents the Sigmoid function. Indicates the convolution operation; S6.
2. Map the small-size primitive-aware attention map alignment operation to each scale to obtain the small-size primitive-aware attention map for each scale. ; S6.
3. Fuse the small-scale primitive perception attention map at each scale with the feature maps at each scale to obtain multi-scale small-scale primitive perception enhancement features: , in, This represents the perceptual enhancement feature of small primitives at the k-th scale. This represents the feature map at the k-th scale extracted in step S2. Indicates the first Scale fusion weights for each scale This represents element-wise multiplication. Indicates will Resolution aligned to the 1st A mapping operation of scales, k=1,…,K, where K represents the number of scales.
7. The enhanced recognition method for small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, Step S7 specifically includes: S7.
1. The relationship enhancement features of each small-sized primitive and the perception enhancement features of small-sized primitives at all scales are fused to obtain the fused features; S7.2 Determine whether there is any risk of occlusion or incompleteness in each small-sized graphic element; S7.3 For each small primitive with the risk of occlusion or incompleteness, based on its fusion features, the local image of the line skeleton within the small primitive, the local mask of text interference within the small primitive, and the geometric features of the relation edges connected to the candidate primitive nodes corresponding to the small primitive, predict the currently visible area, occluded area, and missing completion area in the small primitive: , in, These represent the enhanced features of the i-th small primitive with the risk of occlusion or incompleteness, the local map of the line skeleton, the local mask of text interference, and the geometric features of the relation edges connected to the corresponding nodes of the small primitive, respectively. These represent the currently visible area, occluded area, and missing completion area of the i-th small-sized primitive, respectively, which are at risk of occlusion or incompleteness. This represents a pre-trained hierarchical occlusion prediction network; S7.
4. Based on the currently visible primitive region, occluded region, and missing completion region, structural constraints are reweighted on the fusion features of each small primitive with the risk of occlusion or incompleteness: , in, This represents the features after reweighting of structural constraints. , , These are the corresponding weight coefficients; This indicates element-wise multiplication.
8. The method for enhanced recognition of small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, Step S8 specifically includes: S8.
1. The relationship enhancement features, perception enhancement features, and structural constraint reweighting enhancement features of each small-sized primitive are fused together to obtain the joint features of each small-sized primitive. S8.
2. Based on the joint features, make predictions to obtain the category labels and confidence scores of each small-sized primitive; S8.3 Predict the initial bounding box based on the currently visible area of each small-sized primitive; S8.4 Based on the joint features, initial bounding box, current visible region and missing completion region, input the pre-trained bounding box correction network, predict the bounding box correction amount, and correct the initial bounding box using the bounding box correction amount to obtain the intermediate bounding box. S8.
5. Based on the relationship types in the heterogeneous primitive relationship graph, perform geometric consistency correction on the intermediate bounding boxes to obtain the final bounding boxes.
9. The method for enhanced recognition of small-sized primitives in dot matrix architectural CAD drawings according to claim 1, characterized in that, The parameters used in each step of the calculation are obtained by training with a joint loss function, which is: , Where L is the joint loss, For primitive classification loss, For bounding box regression loss, For small primitive enhancement loss, Predict loss for relation edge types. For relational attention bias constraint loss, To predict loss by occlusion layering, To iteratively correct the loss for the detection boxes, This represents the weight of the corresponding loss.
10. A computer program product comprising a computer program / instructions, characterized in that: When the computer program / instructions are executed by the processor, they implement the method of any one of claims 1-9.