CAD survey drawing intelligent identification method and device based on graph primitive symbol identification
By combining vector symbol recognition of CAD drawings with rasterized pixel images, graphic primitive symbol recognition technology is introduced, which solves the problems of insufficient recognition accuracy and insufficient adaptability of CAD drawings, and achieves a more efficient and accurate recognition effect.
Patent Information
- Application Number
- CN202411418085.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2024-12-20
AI Technical Summary
The existing CAD drawing recognition methods have shortcomings in terms of accuracy and adaptability, especially when dealing with different types of graphic primitives and complex symbols, it is difficult to ensure efficient and accurate.
By acquiring CAD survey drawings and converting them into rasterized pixel images, document layout analysis and OCR recognition are performed, original feature maps are extracted and candidate boxes are generated, panoramic symbols are split into graphic primitives, and two-dimensional features are generated using pre-trained models. Figure, combining graphic primitive embedding for recognition, splicing text information, element locations and graphic primitive symbols for recognition.
It improves the efficiency and accuracy of CAD drawing recognition, solves the problems of insufficient accuracy and incomplete identification, and provides strong technical support for related fields.
Smart Images

Figure CN119169653A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer-aided design, and in particular to a method and device for intelligently identifying CAD survey drawings based on graphic primitive symbol recognition. Background Art
[0002] Computer Aided Design (CAD) technology has been widely used in fields such as architecture, engineering, and manufacturing. However, the complexity and diversity of CAD drawings make efficient and accurate recognition and analysis of them a challenging task. Traditional CAD drawing recognition methods mainly rely on manual annotation and rule matching, which is not only time-consuming and labor-intensive, but also difficult to ensure efficiency and accuracy when processing large-scale data.
[0003] In order to improve the efficiency and accuracy of CAD drawing recognition, in recent years, existing methods based on deep learning and computer vision can automatically extract feature information in drawings by training neural network models, thereby realizing automatic recognition of CAD drawings.
[0004] However, in the practical application of the existing technology, there are problems such as the limited ability of the model to recognize different types of graphic primitives, the low accuracy of recognizing complex symbols in drawings, and the insufficient adaptability of the model to different drawing formats and layouts, which need to be solved urgently. Summary of the invention
[0005] The present application provides a method and device for intelligent recognition of CAD survey drawings based on graphic primitive symbol recognition, so as to solve the problems of insufficient accuracy and incomplete recognition of existing recognition methods in the field of CAD survey drawings.
[0006] The first aspect of the present application provides a method for intelligently identifying CAD survey drawings based on graphic primitive symbol recognition, comprising the following steps: obtaining a CAD survey drawing of an initial file type, and converting the CAD survey drawing into a rasterized pixel image; performing document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and extracting an original feature map of the rasterized pixel image, and generating a plurality of candidate boxes corresponding to the original feature map, so as to determine the element position of a target element in the CAD survey drawing based on the plurality of candidate boxes; splitting the panoramic symbol in the CAD survey drawing into a plurality of graphic primitives, and generating a two-dimensional feature map corresponding to the CAD survey drawing using a pre-trained mapping model, and projecting each of the plurality of graphic primitives onto the two-dimensional feature map to obtain a graphic primitive embedding, and identifying the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding; and splicing the text information, the element position and the graphic primitive panoramic symbol to obtain a recognition splicing result of the CAD survey drawing.
[0007] Optionally, in one embodiment of the present application, obtaining a CAD survey drawing of an initial file type and converting the CAD survey drawing into a rasterized pixel image includes: parsing the CAD survey drawing of the initial file type to extract a target tag and a target attribute of the CAD survey drawing; renaming and adjusting the target tag and the target attribute according to a preset image mapping rule to obtain a standard semantic tag corresponding to the CAD survey drawing; converting the standard semantic tag of the CAD survey drawing into a custom version semantic tag, and generating a rasterized pixel image corresponding to the custom version semantic tag.
[0008] Optionally, in one embodiment of the present application, the document layout analysis and image OCR recognition operations are performed on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, including: denoising and binarizing the rasterized pixel image to obtain a binary rasterized pixel image; based on a preset edge detection and contour extraction algorithm, identifying the edge original contour and the text frame original contour of the binary rasterized pixel image, and extracting contour features of the edge original contour and the frame original contour; classifying the contour features through a pre-trained classification model to obtain a classification result, and determining the text information of the text frame in the rasterized pixel image based on the classification result.
[0009] Optionally, in one embodiment of the present application, the extracting the original feature map of the rasterized pixel image and generating multiple candidate boxes corresponding to the original feature map to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes includes: collecting multiple labeled CAD survey pixel maps, and constructing a CAD survey training data set based on the multiple labeled CAD survey pixel maps, so as to train a preset convolutional neural network through the CAD survey training data set; extracting the original feature map of the rasterized pixel image through the trained convolutional neural network, and inputting the original feature map into a preset region proposal network to generate multiple candidate boxes corresponding to the original feature map; calculating the candidate box score of each candidate box in the multiple candidate boxes, and obtaining the target candidate box corresponding to the highest candidate box score, and inputting the target candidate box into a pre-trained Fast R-CNN to output the element position of the target element in the CAD survey drawing.
[0010] Optionally, in one embodiment of the present application, after splicing the text information, the element position and the graphic primitive panoramic symbol to obtain the recognition splicing result of the CAD survey drawing, it also includes: saving the recognition splicing result as a JSON file, and generating a target image file corresponding to the CAD survey drawing, so as to perform CAD survey drawing visualization operations according to the JSON file and the target image file.
[0011] The second aspect of the present application provides an intelligent recognition device for CAD survey drawings based on graphic primitive symbol recognition, including: a conversion module, used to obtain a CAD survey drawing of an initial file type, and convert the CAD survey drawing into a rasterized pixel image; an extraction module, used to perform document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and extract an original feature map of the rasterized pixel image, and generate a plurality of candidate frames corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the plurality of candidate frames; a recognition module, used to split the panoramic symbol in the CAD survey drawing into a plurality of graphic primitives, and generate a two-dimensional feature map corresponding to the CAD survey drawing by using a pre-trained mapping model, and project each of the plurality of graphic primitives onto the two-dimensional feature map to obtain a graphic primitive embedding, and recognize the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding; a splicing module, used to splice the text information, the element position and the graphic primitive panoramic symbol to obtain the recognition splicing result of the CAD survey drawing.
[0012] Optionally, in one embodiment of the present application, the conversion module includes: a parsing unit, used to parse the CAD survey drawings of the initial file type to extract target tags and target attributes of the CAD survey drawings; an adjustment unit, used to rename and adjust the target tags and the target attributes according to preset image mapping rules to obtain standard semantic tags corresponding to the CAD survey drawings; and a generation unit, used to convert the standard semantic tags of the CAD survey drawings into custom version semantic tags, and generate a rasterized pixel image corresponding to the custom version semantic tags.
[0013] Optionally, in one embodiment of the present application, the extraction module includes: a binarization unit, used to denoise and binarize the rasterized pixel image to obtain a binary rasterized pixel image; an acquisition unit, used to identify the edge original contour and the text frame original contour of the binary rasterized pixel image based on a preset edge detection and contour extraction algorithm, and extract contour features of the edge original contour and the frame original contour; a classification unit, used to classify the contour features through a pre-trained classification model to obtain a classification result, and determine the text information of the text frame in the rasterized pixel image based on the classification result.
[0014] Optionally, in one embodiment of the present application, the extraction module further includes: an acquisition unit, used to acquire multiple labeled CAD survey pixel images, and construct a CAD survey training data set based on the multiple labeled CAD survey pixel images, so as to train a preset convolutional neural network through the CAD survey training data set; an input unit, used to extract the original feature map of the rasterized pixel image through the trained convolutional neural network, and input the original feature map into a preset region proposal network to generate multiple candidate boxes corresponding to the original feature map; a calculation unit, used to calculate the candidate box score of each candidate box in the multiple candidate boxes, and obtain the target candidate box corresponding to the highest candidate box score, and input the target candidate box into the pre-trained Fast R-CNN to output the element position of the target element in the CAD survey drawing.
[0015] Optionally, in one embodiment of the present application, it also includes: a visualization module, which is used to save the recognition and splicing results of the CAD survey drawing as a JSON file after splicing the text information, the element position and the graphic primitive panoramic symbol to obtain the recognition and splicing results of the CAD survey drawing, and at the same time generate a target image file corresponding to the CAD survey drawing, so as to perform CAD survey drawing visualization operations according to the JSON file and the target image file.
[0016] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for intelligent recognition of CAD survey drawings based on graphic primitive symbol recognition as described in the above embodiment.
[0017] The fourth aspect of the present application provides a computer-readable storage medium, which stores a computer program. When the program is executed by a processor, it implements the above-mentioned CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition.
[0018] The fifth aspect of the present application provides a computer program product, including a computer program, which is executed to implement the above-mentioned CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition.
[0019] Therefore, the embodiments of the present application have the following beneficial effects:
[0020] The embodiment of the present application can obtain the CAD survey drawing of the initial file type and convert the CAD survey drawing into a rasterized pixel image; perform document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, extract the original feature map of the rasterized pixel image, and generate multiple candidate boxes corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes; split the panoramic symbol in the CAD survey drawing into multiple graphic primitives, and use the pre-trained mapping model to generate a two-dimensional feature map corresponding to the CAD survey drawing, and project each of the multiple graphic primitives to the two-dimensional feature map to obtain the graphic primitive embedding, and identify the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding; splice the text information, element position and graphic primitive panoramic symbol to obtain the recognition splicing result of the CAD survey drawing. The present application improves the efficiency and accuracy of CAD drawing recognition by performing vector symbol recognition on CAD drawings, combining the rasterized pixel image recognition method, and introducing the graphic primitive symbol recognition technology, and provides strong technical support for practical applications in related fields. This solves the problems of insufficient accuracy and incomplete recognition in the existing recognition methods in the field of CAD survey drawings.
[0021] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0023] Figure 1 A flowchart of a method for intelligently identifying CAD survey drawings based on graphic primitive symbol recognition provided according to an embodiment of the present application;
[0024] Figure 2 A schematic diagram of the execution logic of a method for intelligently identifying CAD survey drawings based on graphic primitive symbol recognition provided in accordance with an embodiment of the present application;
[0025] Figure 3 A schematic diagram of CAD survey drawing data conversion and preprocessing provided for one embodiment of the present application;
[0026] Figure 4 A CAD survey drawing document layout analysis and image recognition flow chart provided for one embodiment of the present application;
[0027] Figure 5 A schematic diagram of disassembling graphic primitives of a CAD survey drawing vector drawing provided for one embodiment of the present application;
[0028] Figure 6 A flow chart of a method for automatically identifying CAD survey drawings provided for one embodiment of the present application;
[0029] Figure 7 A CAD survey drawing content detection effect diagram provided for one embodiment of the present application;
[0030] Figure 8 This is an example diagram of a CAD survey drawing intelligent recognition device based on graphic primitive symbol recognition according to an embodiment of the present application;
[0031] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0032] Among them, 10-a CAD survey drawing intelligent recognition device based on graphic primitive symbol recognition; 100-a conversion module, 200-an extraction module, 300-a recognition module, 400-a splicing module; 901-a memory, 902-a processor, 903-a communication interface. DETAILED DESCRIPTION
[0033] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0034] The following describes the CAD survey drawing intelligent recognition method and device based on graphic primitive symbol recognition of the embodiment of the present application with reference to the accompanying drawings. In view of the problems mentioned in the above background technology, the present application provides a CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition, in which the CAD survey drawing of the initial file type is obtained and the CAD survey drawing is converted into a rasterized pixel image; the rasterized pixel image is subjected to document layout analysis and image OCR recognition operations to obtain text information corresponding to the rasterized pixel image, and the original feature map of the rasterized pixel image is extracted at the same time, and multiple candidate boxes corresponding to the original feature map are generated to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes; the panoramic symbol in the CAD survey drawing is split into multiple graphic primitives, and a two-dimensional feature map corresponding to the CAD survey drawing is generated using a pre-trained mapping model, and each of the multiple graphic primitives is projected onto the two-dimensional feature map to obtain a graphic primitive embedding, and the graphic primitive panoramic symbol of the CAD survey drawing is identified according to the graphic primitive embedding; the text information, element position and graphic primitive panoramic symbol are spliced to obtain the recognition splicing result of the CAD survey drawing. This application improves the efficiency and accuracy of CAD drawing recognition by performing vector symbol recognition on CAD drawings, combining it with a rasterized pixel image recognition method, and introducing graphic primitive symbol recognition technology, providing strong technical support for practical applications in related fields. This solves the problems of insufficient accuracy and incomplete recognition of existing recognition methods in the field of CAD survey drawings.
[0035] Specifically, Figure 1 A flowchart of a method for intelligent recognition of CAD survey drawings based on graphic primitive symbol recognition provided in an embodiment of the present application.
[0036] like Figure 1 As shown, the CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition includes the following steps:
[0037] In step S101, a CAD survey drawing of an initial file type is obtained and converted into a rasterized pixel image.
[0038] The embodiment of the present application can first use a drawing conversion tool (such as svg2png) to convert the vector drawing of the CAD survey drawing into a rasterized pixel image, such as Figure 2 As shown, this provides data support for the execution of subsequent document layout analysis and image OCR recognition and other operations.
[0039] Optionally, in one embodiment of the present application, a CAD survey drawing of an initial file type is obtained, and the CAD survey drawing is converted into a rasterized pixel image, including: parsing the CAD survey drawing of the initial file type to extract target tags and target attributes of the CAD survey drawing; renaming and adjusting the target tags and target attributes according to preset image mapping rules to obtain standard semantic tags corresponding to the CAD survey drawing; converting the standard semantic tags of the CAD survey drawing into custom version semantic tags, and generating a rasterized pixel image corresponding to the custom version semantic tags.
[0040] It should be noted that, in the embodiment of the present application, the drawing to be tested, i.e., the CAD survey drawing (in svg format), is first input into the model, and the semantic label of the CAD drawing is converted into the floorplanCADv1 version (i.e., the custom semantic label version) through the data conversion script svg2png.py and the corresponding rasterized pixel image is generated. The processing flow is as follows: Figure 3 shown.
[0041] Specifically, the embodiments of the present application can first parse the svg file and extract the necessary tags and attributes (i.e., target tags and target attributes), such as architectural environment elements such as houses, ponds, and fields; secondly, define a mapping rule, such as floorplanCADv1, to rename the tags and adjust the attributes so that different CAD survey drawings can obtain unified standardized semantic tags (i.e., standard semantic tags) after conversion, so as to ensure that all architectural and environmental elements retain their semantic meanings during the conversion process, so as to facilitate accurate representation in subsequent steps; thereafter, svg2png can use Python's image processing library OpenCV to convert the processed svg data into a pixel image, set the appropriate resolution and color encoding, and save the rasterized pixel image as a png file, so as to ensure that the image is clear and the information is complete, and maintain the same scale and layout as the original CAD drawing.
[0042] In step S102, document layout analysis and image OCR recognition operations are performed on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and at the same time, the original feature map of the rasterized pixel image is extracted, and multiple candidate boxes corresponding to the original feature map are generated to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes.
[0043] Furthermore, if Figure 4 As shown, the embodiment of the present application can perform document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain the frame and frame coordinates of each element; and for the converted png file, the neural network model is trained using the existing labeled CAD survey pixel drawings, so that the model can fully learn the image features of various elements in the CAD survey drawings.
[0044] Optionally, in one embodiment of the present application, a document layout analysis and an image OCR recognition operation are performed on a rasterized pixel image to obtain text information corresponding to the rasterized pixel image, including: denoising and binarizing the rasterized pixel image to obtain a binary rasterized pixel image; based on a preset edge detection and contour extraction algorithm, identifying the edge original contour and the text frame original contour of the binary rasterized pixel image, and extracting contour features of the edge original contour and the frame original contour; classifying the contour features through a pre-trained classification model to obtain a classification result, and determining the text information of the text frame in the rasterized pixel image based on the classification result.
[0045] It should be noted that the embodiments of the present application can first remove noise and binarize the rasterized pixel image to obtain a binary rasterized pixel image; secondly, the embodiments of the present application can provide an edge detection algorithm and a contour extraction algorithm to identify the edge of the binary rasterized pixel image and the original contour of the frame; thirdly, the embodiments of the present application extract contour features of elements such as area, perimeter, aspect ratio, convex hull, and direction from the original contour of the edge and the original contour of the frame; thereafter, the embodiments of the present application can use a convolutional neural network (i.e., a pre-trained classification model) to classify the extracted contour features and identify different types of elements such as text boxes, graphic boxes, and tables; finally, based on the classification results, the frame of each element is determined, and the coordinates of the lower left and lower right corners of each frame are calculated to form a coordinate matrix, thereby determining the text information of the text frame in the rasterized pixel image.
[0046] Therefore, the embodiment of the present application performs layout analysis on the rasterized pixel image to obtain the frame and frame coordinates of each element, thereby effectively ensuring the reliability of CAD survey drawing recognition.
[0047] Optionally, in one embodiment of the present application, an original feature map of a rasterized pixel image is extracted, and multiple candidate boxes corresponding to the original feature map are generated to determine the element position of a target element in a CAD survey drawing based on the multiple candidate boxes, including: collecting multiple labeled CAD survey pixel maps, and constructing a CAD survey training data set based on the multiple labeled CAD survey pixel maps, so as to train a preset convolutional neural network through the CAD survey training data set; extracting the original feature map of the rasterized pixel image through the trained convolutional neural network, and inputting the original feature map into a preset region proposal network to generate multiple candidate boxes corresponding to the original feature map; calculating a candidate box score for each candidate box in the multiple candidate boxes, and obtaining a target candidate box corresponding to the highest candidate box score, and inputting the target candidate box into a pre-trained Fast R-CNN to output the element position of the target element in the CAD survey drawing.
[0048] In the specific implementation process, the embodiment of the present application can first collect multiple labeled CAD survey pixel images to construct a CAD survey training data set, so as to train a preset convolutional neural network through the CAD survey training data set; secondly, the embodiment of the present application can input the rasterized pixel image of the CAD drawing into a pre-trained convolutional neural network to extract the original features and obtain the feature map of the original image (i.e., the original feature map); thirdly, the embodiment of the present application can input the extracted feature map into RPN (Region Proposal Network), and RPN can generate multiple candidate boxes with different face bases and aspect ratios in the original image and score them, and select the box with the highest score as the input for the next step; thereafter, after the box selection is completed, these candidate boxes are scored, and the one with the highest score is selected as the region of interest (ROI), which is the feature value of the corresponding position of the candidate box; finally, the embodiment of the present application can input the ROI into the pre-trained Fast RCNN to conduct in-depth analysis and detection of the boxed content, and RPN and Fast RCNN shares convolutional layers to quickly generate candidate boxes, quickly and accurately identify and locate elements in the image, and obtain the precise position of the elements in the drawing based on the detection results.
[0049] Therefore, the embodiments of the present application use the DocXChain framework to perform document layout analysis and OCR text recognition on rasterized pixel drawings, extract original features based on a trained convolutional neural network, and generate candidate frames for frame content detection and recognition, thereby providing reliable technical support for enhancing the recognition quality of CAD survey drawings.
[0050] In step S103, the panoramic symbol in the CAD survey drawing is split into multiple graphic primitives, and a two-dimensional feature map corresponding to the CAD survey drawing is generated using a pre-trained mapping model, and each of the multiple graphic primitives is projected onto the two-dimensional feature map to obtain a graphic primitive embedding, and the graphic primitive panoramic symbol of the CAD survey drawing is identified based on the graphic primitive embedding.
[0051] Furthermore, the embodiments of the present application can first apply decomposition to the input vector drawings, split the panoramic symbols into basic graphic primitives, and use a pre-trained mapping model to generate a two-dimensional feature map corresponding to the CAD survey drawing, and then project each graphic primitive onto the two-dimensional feature map to obtain the graphic primitive embedding, and input the embedded image into the processed CADTransformer. The model can learn the relationship between different graphic primitive symbols, thereby identifying each symbol and improving the recognition accuracy of the drawing.
[0052] It can be understood that the embodiments of the present application learn to identify key information in the drawings during the training phase by mining the graphic primitive relationship auxiliary model within the drawing symbols, and use the provided key information to help the pixel image recognition module identify more accurate identification information that contains more drawing elements, thereby making the recognition of CAD survey drawings more precise, smooth and comprehensive, and improving the quality of intelligent recognition of CAD survey drawings.
[0053] In the actual implementation process, for the input CAD vector image, the embodiment of the present application first applies decomposition to split the panoramic symbol into basic graphic primitives (for example, lines, circles or arcs), and completes it by parsing the data structure of the CAD file to identify the basic geometric elements that make up the complex symbol.
[0054] In addition, the embodiment of the present application converts the graphic primitives in vector format into rasterized bitmaps through a special rendering algorithm to adapt to subsequent convolutional neural network processing, such as Figure 5 As shown, panoramic symbol recognition can be expressed as a mapping Fp:ek→(lk,zk)∈L×N, where ek represents the graphic entity of the basic building block of the CAD image, lk and zk are the semantic label and instance index.
[0055] The embedding of graphic primitives is obtained by projecting each graphic primitive onto a two-dimensional feature map output by a pre-trained mapping model. The key visual features of the graphic primitives are captured by a deep learning model to provide data support for subsequent analysis. At the same time, these feature maps reflect the visual content and structural information of the graphic primitives, providing a basis for modeling the relationship between graphic primitives. Through the above-mentioned embedding acquisition method of graphic primitives, the feature map obtained from the mapping model is processed by the processed VisionTransformer, and the Vision Transformer learns the spatial relationship between different graphic primitives through the self-attention mechanism.
[0056] Therefore, the embodiment of the present application performs graphic primitive symbol recognition on the input survey drawings based on CADTransformer, and simultaneously performs original feature extraction and symbol positioning on the rasterized pixel image of the survey drawings, so as to help the model learn to utilize the features and key knowledge of the survey drawings by utilizing the key knowledge in the survey drawing dataset, thereby achieving high-quality and comprehensive information recognition and extraction of CAD survey drawings based on the combination of the two, so as to enhance the model's ability to recognize survey drawings.
[0057] In step S104, the text information, element positions and graphic primitive panoramic symbols are spliced to obtain the recognition splicing result of the CAD survey drawing.
[0058] Afterwards, the embodiment of the present application can stitch and integrate the text information, element positions and graphic primitive panoramic symbols, such as Figure 6 shown.
[0059] Therefore, the embodiments of the present application process and analyze CAD survey drawings through intelligent recognition and matching of graphic primitives and pixel images, which greatly reduces the manpower consumption in the analysis of engineering design drawings, and achieves high recognition speed and accuracy on the public data set floorplanCAD and the self-built survey drawing data set, and at the same time achieves higher recognition speed and accuracy, which has good practicality in the real world.
[0060] Optionally, in one embodiment of the present application, after splicing text information, element positions and graphic primitive panoramic symbols to obtain the recognition and stitching results of the CAD survey drawings, it also includes: saving the recognition and stitching results as a JSON file, and generating a target image file corresponding to the CAD survey drawing, so as to perform CAD survey drawing visualization operations according to the JSON file and the target image file.
[0061] In addition, the embodiment of the present application can output the spliced and integrated recognition results as a JSON file, recording the attributes and position of each recognition element in detail; at the same time, Figure 7 As shown, a PNG image file containing all tags is generated to visually display the recognition results.
[0062] The present application described below constructs a corresponding CAD survey drawing intelligent recognition system based on graphic primitive symbol recognition according to the proposed CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition, and explains the execution logic of the CAD survey drawing intelligent recognition system based on graphic primitive symbol recognition.
[0063] The CAD survey drawing intelligent recognition system based on graphic primitive symbol recognition of the present application mainly includes a CAD drawing data conversion and preprocessing module, a document layout analysis module, a rasterized pixel image recognition module, a graphic primitive panoramic symbol recognition module, a text information recognition and a coordinate information matching output module.
[0064] Among them, the CAD drawing data conversion and preprocessing module can convert the semantic tags of the CAD drawings into customized semantic tag versions through svg2png.py and generate corresponding rasterized pixel images;
[0065] The document layout analysis module is used to perform layout analysis on the rasterized pixel image to obtain the frame and frame coordinates of each element;
[0066] The rasterized pixel image recognition module uses a region-based convolutional neural network to extract features from pixel drawings in the form of image recognition. It mainly uses convolutional neural networks to effectively process image data and automatically extract features that are helpful for classification and detection. In addition, the module can also use the region proposal network RPN to automatically propose areas that may contain targets from the image, while sharing convolutional features with the detection network, greatly improving processing speed and accuracy.
[0067] The graphic primitive panoramic symbol recognition module can directly mark the graphic primitive set of the CAD drawing using a Transformer-based panoramic symbol recognition framework CADTransformer, which mainly encodes the features of the graphic primitives of the CAD drawing, and captures the complex relationship between different graphic primitives and maintains the spatial relationship of the graphic primitives in the drawing through a Transformer encoder containing a multi-layer self-attention mechanism and position encoding;
[0068] The text information recognition and coordinate information matching module can extract text information based on the text frame obtained by document layout analysis using OCR, and match the frame coordinates with the results of the symbol recognition module to generate the final result file;
[0069] The rasterized pixel image recognition module can use existing labeled CAD survey drawings to train the neural network model, so that the model can fully learn the image features of various elements in the CAD survey drawings.
[0070] To summarize, the embodiments of the present application utilize CADTransformer and DocXchain to simultaneously extract the original features and graphic primitive symbols of the rasterized pixel image, and use document layout analysis to locate and filter the extracted content, thereby generating a png file with annotated drawing frames and a JSON file containing location and other information, so as to combine graphic primitives and pixel images for identification and analysis, thereby significantly improving the model's recognition ability for CAD survey drawings; in addition, the embodiments of the present application do not rely on external large models and additional manual processing work, and can also reduce implementation costs while ensuring high efficiency.
[0071] According to the CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition proposed in the embodiment of the present application, a CAD survey drawing of an initial file type is obtained and converted into a rasterized pixel image; document layout analysis and image OCR recognition operations are performed on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and an original feature map of the rasterized pixel image is extracted, and multiple candidate boxes corresponding to the original feature map are generated to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes; the panoramic symbol in the CAD survey drawing is split into multiple graphic primitives, and a two-dimensional feature map corresponding to the CAD survey drawing is generated using a pre-trained mapping model, and each of the multiple graphic primitives is projected onto the two-dimensional feature map to obtain a graphic primitive embedding, and the graphic primitive panoramic symbol of the CAD survey drawing is identified according to the graphic primitive embedding; the text information, element position and graphic primitive panoramic symbol are spliced to obtain the recognition and splicing result of the CAD survey drawing. This application improves the efficiency and accuracy of CAD drawing recognition by performing vector symbol recognition on CAD drawings, combining it with a rasterized pixel image recognition method, and introducing graphic primitive symbol recognition technology, thereby providing strong technical support for practical applications in related fields.
[0072] Secondly, the CAD survey drawing intelligent recognition device based on graphic primitive symbol recognition proposed in an embodiment of the present application is described with reference to the accompanying drawings.
[0073] Figure 8 It is a block diagram of a CAD survey drawing intelligent recognition device based on graphic primitive symbol recognition according to an embodiment of the present application.
[0074] like Figure 8 As shown, the CAD survey drawing intelligent recognition device 10 based on graphic primitive symbol recognition includes: a conversion module 100, an extraction module 200, a recognition module 300 and a splicing module 400.
[0075] The conversion module 100 is used to obtain a CAD survey drawing of an initial file type and convert the CAD survey drawing into a rasterized pixel image.
[0076] The extraction module 200 is used to perform document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and at the same time extract the original feature map of the rasterized pixel image, and generate multiple candidate boxes corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes.
[0077] The recognition module 300 is used to split the panoramic symbol in the CAD survey drawing into multiple graphic primitives, and use a pre-trained mapping model to generate a two-dimensional feature map corresponding to the CAD survey drawing, and project each of the multiple graphic primitives onto the two-dimensional feature map to obtain a graphic primitive embedding, and recognize the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding.
[0078] The stitching module 400 is used to stitch text information, element positions and graphic primitive panoramic symbols to obtain the recognition stitching results of the CAD survey drawings.
[0079] Optionally, in one embodiment of the present application, the conversion module 100 includes: a parsing unit, an adjustment unit and a generation unit.
[0080] The parsing unit is used to parse the CAD survey drawings of the initial file type to extract the target tags and target attributes of the CAD survey drawings.
[0081] The adjustment unit is used to rename and adjust the target label and target attribute according to the preset image mapping rule to obtain the standard semantic label corresponding to the CAD survey drawing.
[0082] The generating unit is used to convert the standard semantic tags of the CAD survey drawings into the custom version semantic tags, and generate the rasterized pixel images corresponding to the custom version semantic tags.
[0083] Optionally, in one embodiment of the present application, the extraction module 200 includes: a binarization unit, an acquisition unit and a classification unit.
[0084] The binarization unit is used to perform denoising and binarization processing on the rasterized pixel image to obtain a binary rasterized pixel image.
[0085] The acquisition unit is used to identify the edge original contour of the binary rasterized pixel image and the text frame original contour based on a preset edge detection and contour extraction algorithm, and extract contour features of the edge original contour and the text frame original contour.
[0086] The classification unit is used to classify the contour features through a pre-trained classification model to obtain a classification result, and determine the text information of the text frame in the rasterized pixel image according to the classification result.
[0087] Optionally, in one embodiment of the present application, the extraction module 200 further includes: a collection unit, an input unit and a calculation unit.
[0088] Among them, the acquisition unit is used to acquire multiple labeled CAD survey pixel images, and construct a CAD survey training data set based on the multiple labeled CAD survey pixel images, so as to train a preset convolutional neural network through the CAD survey training data set.
[0089] The input unit is used to extract the original feature map of the rasterized pixel image through the trained convolutional neural network, and input the original feature map into a preset region proposal network to generate multiple candidate boxes corresponding to the original feature map.
[0090] A calculation unit is used to calculate a candidate box score of each candidate box in a plurality of candidate boxes, obtain a target candidate box corresponding to the highest candidate box score, and input the target candidate box into a pre-trained Fast R-CNN to output an element position of the target element in the CAD survey drawing.
[0091] Optionally, in one embodiment of the present application, the CAD survey drawing intelligent recognition device 10 based on graphic primitive symbol recognition of the embodiment of the present application also includes: a visualization module, which is used to save the recognition splicing results of the CAD survey drawings as a JSON file after splicing text information, element positions and graphic primitive panoramic symbols to obtain the recognition splicing results of the CAD survey drawings, and at the same time generate a target image file corresponding to the CAD survey drawings, so as to perform CAD survey drawing visualization operations according to the JSON file and the target image file.
[0092] It should be noted that the aforementioned explanation of the embodiment of the method for intelligently identifying CAD survey drawings based on graphic primitive symbol recognition is also applicable to the device for intelligently identifying CAD survey drawings based on graphic primitive symbol recognition in this embodiment, and will not be repeated here.
[0093] The CAD survey drawing intelligent recognition device based on graphic primitive symbol recognition proposed in the embodiment of the present application includes a conversion module, which is used to obtain a CAD survey drawing of an initial file type and convert the CAD survey drawing into a rasterized pixel image; an extraction module, which is used to perform document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and at the same time extract the original feature map of the rasterized pixel image, and generate multiple candidate boxes corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the multiple candidate boxes; a recognition module, which is used to split the panoramic symbol in the CAD survey drawing into multiple graphic primitives, and generate a two-dimensional feature map corresponding to the CAD survey drawing using a pre-trained mapping model, and project each of the multiple graphic primitives onto the two-dimensional feature map to obtain a graphic primitive embedding, and recognize the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding; a splicing module, which is used to splice the text information, element position and graphic primitive panoramic symbol to obtain the recognition splicing result of the CAD survey drawing. This application improves the efficiency and accuracy of CAD drawing recognition by performing vector symbol recognition on CAD drawings, combining it with a rasterized pixel image recognition method, and introducing graphic primitive symbol recognition technology, thereby providing strong technical support for practical applications in related fields.
[0094] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0095] A memory 901 , a processor 902 , and a computer program stored in the memory 901 and executable on the processor 902 .
[0096] When the processor 902 executes the program, the CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition provided in the above embodiment is implemented.
[0097] Furthermore, the electronic device further comprises:
[0098] The communication interface 903 is used for communication between the memory 901 and the processor 902 .
[0099] The memory 901 is used to store computer programs that can be executed on the processor 902 .
[0100] The memory 901 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0101] If the memory 901, the processor 902 and the communication interface 903 are implemented independently, the communication interface 903, the memory 901 and the processor 902 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0102] Optionally, in a specific implementation, if the memory 901, the processor 902 and the communication interface 903 are integrated on a chip, the memory 901, the processor 902 and the communication interface 903 can communicate with each other through an internal interface.
[0103] The processor 902 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0104] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned method for intelligent recognition of CAD survey drawings based on graphic primitive symbol recognition.
[0105] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed, is used to implement the above-mentioned CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition.
[0106] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0107] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0108] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0109] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways as necessary and then storing it in a computer memory.
[0110] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0111] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0112] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0113] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for intelligent recognition of CAD survey drawings based on graphic primitive symbol recognition, characterized in that: The following steps are involved: Acquire a CAD survey drawing of an initial file type, and convert the CAD survey drawing into a rasterized pixel image; Performing document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, extracting an original feature map of the rasterized pixel image, and generating a plurality of candidate frames corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the plurality of candidate frames; Splitting the panoramic symbol in the CAD survey drawing into a plurality of graphic primitives, generating a two-dimensional feature map corresponding to the CAD survey drawing using a pre-trained mapping model, projecting each of the plurality of graphic primitives onto the two-dimensional feature map to obtain a graphic primitive embedding, and identifying the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding; The text information, the element position and the graphic primitive panoramic symbol are spliced together to obtain the recognition splicing result of the CAD survey drawing.
2. The method according to claim 1, characterized in that The step of obtaining a CAD survey drawing of an initial file type and converting the CAD survey drawing into a rasterized pixel image comprises: Parsing the CAD survey drawing of the initial file type to extract target tags and target attributes of the CAD survey drawing; renaming and adjusting the target label and the target attribute according to a preset image mapping rule to obtain a standard semantic label corresponding to the CAD survey drawing; The standard semantic tags of the CAD survey drawings are converted into custom version semantic tags, and a rasterized pixel image corresponding to the custom version semantic tags is generated.
3. The method according to claim 2, characterized in that The performing document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image includes: Performing denoising and binarization processing on the rasterized pixel image to obtain a binary rasterized pixel image; Based on a preset edge detection and contour extraction algorithm, the original edge contour of the binary rasterized pixel image and the original text frame contour are identified, and contour features of the original edge contour and the original text frame contour are extracted; The contour features are classified by a pre-trained classification model to obtain a classification result, and the text information of the text frame in the rasterized pixel image is determined according to the classification result.
4. The method according to claim 3, characterized in that: The extracting the original feature map of the rasterized pixel image and generating a plurality of candidate frames corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the plurality of candidate frames, comprises: Collecting a plurality of labeled CAD survey pixel images, and constructing a CAD survey training data set based on the plurality of labeled CAD survey pixel images, so as to train a preset convolutional neural network through the CAD survey training data set; Extracting an original feature map of the rasterized pixel image through a trained convolutional neural network, and inputting the original feature map into a preset region proposal network to generate a plurality of candidate boxes corresponding to the original feature map; A candidate frame score of each candidate frame in the multiple candidate frames is calculated, and a target candidate frame corresponding to the highest candidate frame score is obtained, and the target candidate frame is input into a pre-trained Fast R-CNN to output an element position of the target element in the CAD survey drawing.
5. The method according to claim 1, characterized in that After the text information, the element position and the graphic primitive panoramic symbol are spliced to obtain the recognition splicing result of the CAD survey drawing, the method further includes: The recognition and splicing results are saved as a JSON file, and a target image file corresponding to the CAD survey drawing is generated at the same time, so as to perform a CAD survey drawing visualization operation according to the JSON file and the target image file.
6. A CAD survey drawing intelligent recognition device based on graphic primitive symbol recognition, characterized in that: include: A conversion module, used for acquiring a CAD survey drawing of an initial file type, and converting the CAD survey drawing into a rasterized pixel image; An extraction module is used to perform document layout analysis and image OCR recognition operations on the rasterized pixel image to obtain text information corresponding to the rasterized pixel image, and extract an original feature map of the rasterized pixel image, and generate a plurality of candidate frames corresponding to the original feature map, so as to determine the element position of the target element in the CAD survey drawing based on the plurality of candidate frames; a recognition module, configured to split the panoramic symbol in the CAD survey drawing into a plurality of graphic primitives, generate a two-dimensional feature map corresponding to the CAD survey drawing using a pre-trained mapping model, project each of the plurality of graphic primitives onto the two-dimensional feature map to obtain a graphic primitive embedding, and recognize the graphic primitive panoramic symbol of the CAD survey drawing according to the graphic primitive embedding; The splicing module is used to splice the text information, the element position and the graphic primitive panoramic symbol to obtain the recognition splicing result of the CAD survey drawing.
7. The device according to claim 6, characterized in that The conversion module comprises: A parsing unit, used for parsing the CAD survey drawing of the initial file type to extract the target tag and target attribute of the CAD survey drawing; An adjustment unit, configured to rename and adjust the target label and the target attribute according to a preset image mapping rule, so as to obtain a standard semantic label corresponding to the CAD survey drawing; The generating unit is used to convert the standard semantic tags of the CAD survey drawing into custom version semantic tags, and generate a rasterized pixel image corresponding to the custom version semantic tags.
8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for intelligent recognition of CAD survey drawings based on graphic primitive symbol recognition as described in any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition as described in any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that The computer program is executed to implement the CAD survey drawing intelligent recognition method based on graphic primitive symbol recognition as described in any one of claims 1 to 5.
Citation Information
Cited By
Subspace three-dimensional model generation method and device based on CAD drawing, medium and equipment
CN119359958A
Engineering drawing intelligent identification system and method based on deep learning
CN120748001A
Railway signal drawing analysis method, system and device
CN120808372A
BIM modeling method and device based on large language model, equipment, medium and product
CN121071999A
Layout analysis method and device, electronic equipment and storage medium
CN121281080A
