Methods, apparatus, equipment, media, and products for determining the graphic information in graphic files.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-22
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]然而,实际图纸命名极不规范,导致传统依赖文件名的信息提取方法失效
[0082] This application provides a method, apparatus, device, medium, and product for determining the graphic information of a drawing file. The method includes acquiring a drawing file of a building project, acquiring the relative path of the drawing file, and performing image conversion processing on the drawing file to obtain a first image and a second image; performing matching processing based on the relative path in a preset path feature library to obtain first attribute information; performing text conversion processing on the first image to obtain second attribute information; performing recognition processing on the second image based on an intelligent model to obtain third attribute information; and performing weighted fusion processing on the first, second, and third attribute information to obtain the graphic information of the drawing file. In this embodiment, through the collaborative extraction and fusion decision of relative path, text content, and visual features, an integrated recognition process for multi-source heterogeneous drawings in building projects is constructed. This enables the drawing file to output professional category, drawing type, and layer information even when the completeness and reliability of various information differ, thereby improving the accuracy, stability, and usability of the determined graphic information in engineering applications.
Smart Images

Figure CN122551385A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of architectural engineering technology, and in particular to a method, apparatus, equipment, medium and product for determining drawing information in a drawing file. Background Technology
[0002] In the field of architectural engineering, a project involves a large number of drawings, covering multiple disciplines, types, and different floors. Accurately determining the professional category, drawing type, and floor number of each drawing is a crucial foundation for the project's commencement.
[0003] However, the naming conventions of actual drawings are highly inconsistent, rendering traditional information extraction methods that rely on filenames ineffective. Existing technologies often depend on a single information source and have coarse-grained classification, lacking the ability to identify floors and making it difficult to accurately determine drawing information.
[0004] Therefore, there is an urgent need for a solution that can efficiently and quickly determine the graph information of a graph file. Summary of the Invention
[0005] This application provides a method, apparatus, device, medium, and product for determining the image information of an image file, so as to achieve the effect of efficiently and quickly determining the image information of an image file.
[0006] In a first aspect, embodiments of this application provide a method for determining image information of an image file, including:
[0007] Obtain the drawing file of the architectural project; obtain the relative path of the drawing file; and perform image conversion processing on the drawing file to obtain a first image and a second image; wherein, the relative path represents the path information of the drawing file relative to a preset base directory; the image resolution of the first image is higher than that of the second image;
[0008] The first attribute information is obtained by matching the relative path in a preset path feature library; the second attribute information is obtained by converting the text of the first image; the third attribute information is obtained by recognizing the second image based on the intelligent model; wherein, the first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text of the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image.
[0009] The first attribute information, the second attribute information, and the third attribute information are weighted and fused to obtain the drawing information of the drawing file. The drawing information is used to indicate the professional category, drawing type, and number of floors of the drawing file of the architectural project.
[0010] In one possible implementation, the first image undergoes text conversion processing to obtain second attribute information, including:
[0011] Perform text recognition processing on the first image to obtain a text list;
[0012] Based on a preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is then merged to obtain merged candidate text data.
[0013] Based on a preset second matching rule, the merged candidate text data is filtered to obtain target text data; wherein, the preset first matching rule is a regular expression matching rule based on preset keywords; and the preset second matching rule is a rule based on text format filtering.
[0014] Based on the target text data, the target image and text information is determined;
[0015] The target image and text information is matched and processed based on a preset image and text database to obtain the second attribute information.
[0016] In one possible implementation, the first image undergoes text recognition processing to obtain a text list, including:
[0017] The first image is processed to extract text, and the coordinates of the character text boxes are obtained. The character text boxes are expanded outward by a preset pixel distance from their coordinates to obtain other character text boxes that intersect with them. The other intersecting character text boxes are clustered to obtain the first text information.
[0018] If it is determined that the amount of data in the first text information is less than a preset threshold, then it is determined that optical character recognition processing is performed on the first image to obtain the second text information; the first text information and the second text information are then fused and deduplicated to obtain the third text information.
[0019] The third text information is then subjected to confidence filtering and sorting processes to obtain a text list.
[0020] In one possible implementation, the third text information is sequentially subjected to confidence filtering and sorting processes to obtain a text list, including:
[0021] Obtain the character confidence score and spatial coordinates of each text element in the third text information; the text element is a single character or a text fragment formed by clustering;
[0022] Based on a preset first confidence threshold, text elements with a character confidence level lower than the first confidence threshold are removed to form a first filter set;
[0023] For the text elements in the first filter set, they are merged in the same row or column according to their spatial coordinates to obtain multiple text paragraphs, and the average confidence of each text paragraph is calculated.
[0024] Based on a preset second confidence threshold, text segments with an average confidence level lower than the second confidence threshold are removed to form a second filter set;
[0025] According to the preset spatial sorting rules, the text paragraphs in the second filter set are sorted. The spatial sorting rules include first arranging them in the order of rows from top to bottom, and then arranging them in the order of columns from left to right within the same row. The sorted set of text paragraphs is then determined as a text list.
[0026] In one possible implementation, the text list is filtered to obtain the target image and text information, including:
[0027] Based on the preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is then merged to obtain merged candidate text data.
[0028] Based on the preset second matching rule, the merged candidate text data is filtered to obtain the target text data; wherein, the preset first matching rule is a regular expression matching rule based on preset keywords; and the preset second matching rule is a rule based on text format filtering.
[0029] Based on the target text data, determine the target graphic and text information.
[0030] In one possible implementation, the second image is processed based on an intelligent model to obtain third attribute information, including:
[0031] The second image is binarized to obtain the target image;
[0032] The target image is input into the intelligent model, and the model processes the image to obtain the third attribute information output by the intelligent model. The intelligent model is obtained by fine-tuning the parameters of an initial model based on a training dataset. The training dataset includes historical drawing files of architectural engineering projects with pre-labeled drawing type tags; including:
[0033] Obtain the training dataset; process the training dataset to obtain processed images; input the processed images into the initial model for further processing to obtain historical feature vectors and classification results;
[0034] Based on the classification results and drawing type labels, a task loss function is determined; based on historical feature vectors, a comparison loss function is determined; wherein, the comparison loss function is used to constrain the feature vector distance of drawings of the same type to be less than the feature vector distance of drawings of different types.
[0035] The initial model is backpropagated using the weighted sum of the task loss function and the contrastive loss function as the total loss.
[0036] During backpropagation, the parameters of the shallow convolutional layers of the initial model are frozen, and the parameters of the deep convolutional layers and the attention modules corresponding to the attention mechanism of the initial model are updated to obtain the intelligent model.
[0037] In one possible implementation, the drawing information includes at least one of the following: the professional category of the building project, the drawing type, and the number of floors; the first attribute information includes one of the professional category, the drawing type, and the number of floors, and its confidence level; the second attribute information includes at least one of the professional category, the drawing type, and the number of floors, and its confidence level; and the third attribute information includes at least the drawing type and its confidence level.
[0038] The first attribute information, the second attribute information, and the third attribute information are weighted and fused to obtain the graph information of the graph file, including:
[0039] Based on the professional categories and their confidence levels of the first attribute information and the professional categories and their confidence levels of the second attribute information, the professional categories of the graph information are determined.
[0040] The drawing type of the drawing information is determined based on the drawing type and its confidence level of the first attribute information, the drawing type and its confidence level of the second attribute information, and the drawing type and its confidence level of the third attribute information.
[0041] The layer number information of the graph information is determined based on the layer number information and its confidence level of the first attribute information and the layer number information and its confidence level of the second attribute information.
[0042] Secondly, embodiments of this application provide an apparatus for determining image information of an image file, comprising:
[0043] The acquisition module is used to acquire the drawing files of the architectural project; acquire the relative path of the drawing files; and perform image conversion processing on the drawing files to obtain a first image and a second image; wherein, the relative path represents the path information of the drawing file relative to a preset base directory; the image resolution of the first image is higher than that of the second image;
[0044] The processing module is used to perform matching processing in a preset path feature library based on relative paths to obtain first attribute information; perform text conversion processing on the first image to obtain second attribute information; and perform recognition processing on the second image based on an intelligent model to obtain third attribute information. The first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text in the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image.
[0045] The fusion module is used to perform weighted fusion processing on the first attribute information, the second attribute information, and the third attribute information to obtain the drawing information of the drawing file; the drawing information is used to indicate the professional category, drawing type, and number of floors of the architectural engineering drawing file.
[0046] In one possible implementation, the processing module includes:
[0047] Perform text recognition processing on the first image to obtain a text list;
[0048] Based on a preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is then merged to obtain merged candidate text data.
[0049] Based on a preset second matching rule, the merged candidate text data is filtered to obtain target text data; wherein, the preset first matching rule is a regular expression matching rule based on preset keywords; and the preset second matching rule is a rule based on text format filtering.
[0050] Based on the target text data, the target image and text information is determined;
[0051] The target image and text information is matched and processed based on a preset image and text database to obtain the second attribute information.
[0052] In one possible implementation, the first image undergoes text recognition processing to obtain a text list, including:
[0053] The first image is processed to extract text, and the coordinates of the character text boxes are obtained. The character text boxes are expanded outward by a preset pixel distance from their coordinates to obtain other character text boxes that intersect with them. The other intersecting character text boxes are clustered to obtain the first text information.
[0054] If it is determined that the amount of data in the first text information is less than a preset threshold, then it is determined that optical character recognition processing is performed on the first image to obtain the second text information; the first text information and the second text information are then fused and deduplicated to obtain the third text information.
[0055] The third text information is then subjected to confidence filtering and sorting processes to obtain a text list.
[0056] In one possible implementation, the third text information is sequentially subjected to confidence filtering and sorting processes to obtain a text list, including:
[0057] Obtain the character confidence score and spatial coordinates of each text element in the third text information; the text element is a single character or a text fragment formed by clustering;
[0058] Based on a preset first confidence threshold, text elements with a character confidence level lower than the first confidence threshold are removed to form a first filter set;
[0059] For the text elements in the first filter set, they are merged in the same row or column according to their spatial coordinates to obtain multiple text paragraphs, and the average confidence of each text paragraph is calculated.
[0060] Based on a preset second confidence threshold, text segments with an average confidence level lower than the second confidence threshold are removed to form a second filter set;
[0061] According to the preset spatial sorting rules, the text paragraphs in the second filter set are sorted. The spatial sorting rules include first arranging them in the order of rows from top to bottom, and then arranging them in the order of columns from left to right within the same row. The sorted set of text paragraphs is then determined as a text list.
[0062] In one possible implementation, the text list is filtered to obtain the target image and text information, including:
[0063] Based on the preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is then merged to obtain merged candidate text data.
[0064] Based on the preset second matching rule, the merged candidate text data is filtered to obtain the target text data; wherein, the preset first matching rule is a regular expression matching rule based on preset keywords; and the preset second matching rule is a rule based on text format filtering.
[0065] Based on the target text data, determine the target graphic and text information.
[0066] In one possible implementation, the processing module includes:
[0067] The second image is binarized to obtain the target image;
[0068] The target image is input into the intelligent model, and the model processes the image to obtain the third attribute information output by the intelligent model. The intelligent model is obtained by fine-tuning the parameters of an initial model based on a training dataset. The training dataset includes historical drawing files of architectural engineering projects with pre-labeled drawing type tags; including:
[0069] Obtain the training dataset; process the training dataset to obtain processed images; input the processed images into the initial model for further processing to obtain historical feature vectors and classification results;
[0070] Based on the classification results and drawing type labels, a task loss function is determined; based on historical feature vectors, a comparison loss function is determined; wherein, the comparison loss function is used to constrain the feature vector distance of drawings of the same type to be less than the feature vector distance of drawings of different types.
[0071] The initial model is backpropagated using the weighted sum of the task loss function and the contrastive loss function as the total loss.
[0072] During backpropagation, the parameters of the shallow convolutional layers of the initial model are frozen, and the parameters of the deep convolutional layers and the attention modules corresponding to the attention mechanism of the initial model are updated to obtain the intelligent model.
[0073] In one possible implementation, the drawing information includes at least one of the following: the professional category of the architectural project, the drawing type, and the number of floors; the first attribute information includes one of the professional category, the drawing type, and the number of floors, and its confidence level; the second attribute information includes at least one of the professional category, the drawing type, and the number of floors, and its confidence level; the third attribute information includes at least the drawing type and its confidence level; the fusion module includes:
[0074] Based on the professional categories and their confidence levels of the first attribute information and the professional categories and their confidence levels of the second attribute information, the professional categories of the graph information are determined.
[0075] The drawing type of the drawing information is determined based on the drawing type and its confidence level of the first attribute information, the drawing type and its confidence level of the second attribute information, and the drawing type and its confidence level of the third attribute information.
[0076] The layer number information of the graph information is determined based on the layer number information and its confidence level of the first attribute information and the layer number information and its confidence level of the second attribute information.
[0077] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0078] The memory stores the instructions that the computer executes;
[0079] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0080] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0081] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0082] This application provides a method, apparatus, device, medium, and product for determining the graphic information of a drawing file. The method includes acquiring a drawing file of a building project, acquiring the relative path of the drawing file, and performing image conversion processing on the drawing file to obtain a first image and a second image; performing matching processing based on the relative path in a preset path feature library to obtain first attribute information; performing text conversion processing on the first image to obtain second attribute information; performing recognition processing on the second image based on an intelligent model to obtain third attribute information; and performing weighted fusion processing on the first, second, and third attribute information to obtain the graphic information of the drawing file. In this embodiment, through the collaborative extraction and fusion decision of relative path, text content, and visual features, an integrated recognition process for multi-source heterogeneous drawings in building projects is constructed. This enables the drawing file to output professional category, drawing type, and layer information even when the completeness and reliability of various information differ, thereby improving the accuracy, stability, and usability of the determined graphic information in engineering applications. Attached Figure Description
[0083] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0084] Figure 1 A flowchart illustrating a method for determining image information of an image file provided in this application embodiment. Figure 1 ;
[0085] Figure 2 A flowchart illustrating a method for determining image information of an image file provided in this application embodiment. Figure 2 ;
[0086] Figure 3 A flowchart illustrating step S203 in a method for determining image information of an image file provided in an embodiment of this application;
[0087] Figure 4 A schematic diagram of the structure of a device for determining image information of an image file provided in an embodiment of this application. Figure 1 ;
[0088] Figure 5 A schematic diagram of the structure of a device for determining image information of an image file provided in an embodiment of this application. Figure 2 ;
[0089] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0090] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0091] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0092] In the field of construction engineering, construction projects typically involve a large number of drawings and documents. These drawings cover multiple professional fields such as architecture, structure, water supply and drainage, electrical, and HVAC. Each drawing must clearly indicate its professional category (e.g., architectural drawing, structural drawing), drawing type (e.g., floor plan, elevation, detailed drawing), and the floor it belongs to (e.g., first floor, second floor, basement). As the core basis for engineering design, construction, and acceptance, the accuracy of the information in the drawings directly affects the project progress, cost control, and quality assurance.
[0093] However, in actual engineering projects, the naming rules for drawing files often lack a unified standard. Different projects, different design units, and even within the same project, completely different naming methods may be used, making it difficult to directly extract drawing information (such as professional category, type, and floor) from the file name. Furthermore, the drawing content itself may contain a large amount of text, symbols, and graphics. Traditional methods relying on manual or simple rule-based parsing cannot efficiently handle drawings with complex formats and are prone to misinterpretation due to incorrect file naming or ambiguous content. With the popularization of BIM (Building Information Modeling) technology and the exponential growth of engineering data, how to quickly and accurately extract and associate professional category, type, and floor information from massive amounts of drawings has become a key challenge for improving project management efficiency and achieving digital delivery.
[0094] To address the aforementioned issues, this application provides a method for determining the image information of an image file. This method involves acquiring the image file and obtaining its relative path to a preset baseline directory. Simultaneously, image conversion processing is performed on the image file to obtain a first image with higher resolution and a second image with lower resolution. Subsequently, matching processing is performed on the relative path within a preset path feature library to obtain first attribute information representing path attributes. Text conversion processing is then performed on the first image to obtain second attribute information representing text attributes. Finally, recognition processing is performed on the second image based on an intelligent model to obtain third attribute information representing visual attributes. Based on this, a weighted fusion processing is performed on the first, second, and third attribute information to obtain the image information of the image file.
[0095] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0096] Figure 1 A flowchart illustrating a method for determining image information of an image file provided in this application embodiment. Figure 1 ,like Figure 1 As shown, the method includes:
[0097] S101. Obtain the drawing file of the architectural project; obtain the relative path of the drawing file; and perform image conversion processing on the drawing file to obtain the first image and the second image.
[0098] The relative path represents the path information of the image file relative to the preset base directory; the image resolution of the first image is higher than that of the second image.
[0099] For example, a drawing file can be understood as an electronic drawing file formed and stored during the design, construction, review, modification or archiving process of a building project. The file format can be DWG (Drawing), DXF (Drawing Exchange Format), DWF (Design Web Format), PDF (Portable Document Format), TIFF (Tagged Image File Format), PNG (Portable Network Graphics), JPG (Joint Photographic Experts Group) or an intermediate format file exported from vector graphics paper.
[0100] A relative path can be understood as the path expression formed by the combination of the directory hierarchy position of the image file under the preset base directory and its file name. It is used to represent the hierarchical relationship of the image file relative to the project root directory, professional archive directory, or batch processing receiving directory. The preset base directory can be understood as the project-level root path or business processing root path specified by the system in advance.
[0101] For example, the implementing entity can be a drawing information determination service deployed on a project management platform, a BIM (Building Information Modeling) collaborative platform, an enterprise document management system, or a cloud-based drawing processing platform, or it can be an independent server, a containerized service node, or a local edge processing device that communicates with the aforementioned platforms.
[0102] For example, obtaining architectural drawings can be achieved in various ways, such as receiving files to be processed from local disk arrays, network attached storage, object storage, project file systems, version control repositories, email attachment import directories, application interface upload channels, or file buffers corresponding to message queues.
[0103] When obtaining the relative path of a drawing file, the project root directory can be pre-configured as a preset base directory. For example, a project's overall directory, a stage's archive directory, or a professional document receiving directory can be used as a reference. After the system reads the absolute path of the drawing file in the file system, it truncates it according to the preset base directory to obtain a relative path string containing only the names of subfolders and filenames. If the drawing file originates from object storage or database records rather than a traditional file system, object key names, directory labels, or logical category paths can also be mapped to relative paths.
[0104] After obtaining the path, the drawing file undergoes image conversion processing. For vector files such as DWG, a CAD (Computer-Aided Design) rendering engine, graphics conversion component, or format parsing library can be called to render the drawing page as a bitmap according to the specified paper range, background color, line width display parameters, and layer display rules. For PDF-type drawing files, images can be generated through page decoding and rasterization. For files that are already in image format, resampling and standardization processing can be performed directly.
[0105] In one possible embodiment, the system outputs two sets of image representations for the same drawing file. The first image uses a rendering resolution of 300 dpi (Dots Per Inch) to 600 dpi, or an output parameter with a long side of no less than 3000 pixels, to ensure that the title block, title area, floor label, drawing name area, and explanatory text have sufficient clarity in OCR (Optical Character Recognition) processing. The second image uses a rendering resolution of 72 dpi to 150 dpi, or an output parameter with a long side controlled between 640 and 1280 pixels, so that the intelligent model can extract visual features related to the overall layout, line distribution, symbol density, and drawing category with lower computational overhead.
[0106] Preprocessing steps can be added during image conversion, such as grayscale conversion, noise reduction, binarization, tilt correction, edge cropping, background unification, and frame positioning. If rotation, scanning skew, black borders, or extra blank areas are detected in the drawing, they can be corrected first using Hough transform, border detection, or layout analysis before outputting the first and second images.
[0107] By simultaneously acquiring relative paths and constructing image representations at different resolutions during the image file receiving stage, the implicit semantic information in the architectural engineering catalog system is preserved on the one hand, and matching data carriers are provided for text semantic extraction and visual semantic recognition on the other hand. This lays the foundation for subsequent multi-source attribute collaborative determination and effectively reduces the adverse effects on the accuracy of image information determination when a single information source is missing.
[0108] S102. Based on the relative path, perform matching processing in the preset path feature library to obtain the first attribute information; perform text conversion processing on the first image to obtain the second attribute information; perform recognition processing on the second image based on the intelligent model to obtain the third attribute information.
[0109] The first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text of the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image.
[0110] For example, the preset path feature library can be understood as a set of path semantic knowledge pre-built and stored in a database, rule engine or configuration file, used to establish the association between path fragments and drawing attributes.
[0111] The first attribute information is structured attribute data obtained based on the relative path matching results, including at least candidate professional categories, candidate drawing types, candidate number of floors, and the matching confidence level corresponding to each candidate.
[0112] Text conversion processing can be understood as the process of detecting, recognizing, cleaning, and semantically merging the text content in the first image.
[0113] The second attribute information is structured attribute data extracted from title bar text, descriptive text, figure title text, floor labels, professional descriptions, or other text areas.
[0114] Intelligent models can be understood as image recognition models obtained through training on samples. The model types can be convolutional neural network models, visual Transformer models, joint detection and classification models, or multi-task learning models.
[0115] The third attribute information is structured attribute data inferred from the visual features of the second image, such as the overall layout, local symbols, line structure, and layout pattern.
[0116] For example, in the path matching process, the system first performs word segmentation and hierarchical parsing on the relative path to obtain the directory name sequence, file name body, extension, and position index of each level node. Then, each path fragment is compared with feature words, synonyms, abbreviations, professional tags, floor expression patterns, and drawing purpose tags in the preset path feature library.
[0117] Understandably, during matching, not only can exact matching be performed, but also fuzzy matching, regular expression matching, edit distance matching, pinyin abbreviation matching, or cross-language dictionary mapping, to accommodate real-world engineering data with non-standard naming conventions.
[0118] In one possible embodiment, the system assigns different base scores to different nodes based on their path hierarchy position. For example, the hit feature weight in the filename is higher than that in the general project name in the upper-level directory, and the closer the hierarchical fragment is to the filename, the greater its contribution to the drawing attribute judgment. Through this processing, first attribute information can be obtained, which may include candidate results in the form of "professional category = structure, confidence level 0.82; drawing type = floor plan, confidence level 0.61; number of layers = 2 layers, confidence level 0.74", etc.
[0119] In the text conversion processing section, the system performs an OCR workflow adapted to the engineering drawing scenario for the first image. First, it uses text detection models, connected component analysis, or layout analysis algorithms to locate regions that may contain text. Common regions include title bars, figure labels, headers and footers, figure titles, local node annotation areas, layer number annotation areas, and design description areas. Then, the detected text regions undergo rotation correction, contrast enhancement, local magnification, binarization, and noise reduction before being input into the OCR recognition engine to obtain the text content.
[0120] Optionally, the system can extract professional category, drawing type, and floor number information from the identified text through a combination of keyword extraction, named entity recognition, template field localization, and rule parsing. For drawings with significant differences in title block styles, the drawing name field and professional field can be located through layout adaptation; for fragmented recognition results, scattered text can be reassembled into complete fields based on text spatial proximity. After processing, second attribute information is formed, which not only includes candidate attribute values but also their source text fragments, text location, OCR confidence, and standardized mapping results.
[0121] In the intelligent model-based recognition process, the system inputs the second image into a pre-trained intelligent model. This model can be trained using a large number of labeled architectural drawings. The training labels include professional categories, drawing types, and floor number ranges. The input samples cover different design units, different format standards, different drawing qualities, and different project stages to enhance the model's generalization ability. During inference, the model can extract global layout features and local structural features from the image. For floor number recognition, the intelligent model does not simply read the floor text directly, but can combine floor plan patterns, standard floor repetition features, special roof structures, and common layout features of basements for auxiliary judgment. Therefore, it can still form a certain recognition capability even when the text information is incomplete. The model output can adopt a multi-head classification structure, outputting the probability distributions of professional categories, drawing types, and floor numbers separately, or it can output a unified attribute embedding vector and then map it to attribute labels.
[0122] By extracting attribute features from three dimensions—relative path, drawing text, and image visuals—three independent yet complementary sources of evidence can be formed. This allows the system to not only quickly obtain coarse-grained classification clues using catalog semantics, but also to complete refined verification with the help of textual and visual semantics. This significantly improves the system's adaptability to scenarios involving inconsistent naming, OCR misidentification, and similar drawing layouts.
[0123] S103. Perform weighted fusion processing on the first attribute information, the second attribute information, and the third attribute information to obtain the drawing information of the drawing file. The drawing information is used to indicate the professional category, drawing type, and number of floors of the drawing file of the architectural project.
[0124] For example, the diagram information can be understood as the structured identification result of the final diagram file, which includes at least one or more of the professional category, drawing type and layer information, and may further include the final confidence level, attribute source description, conflict markers and standardized codes for use in the retrieval index.
[0125] Professional category can be used to represent the professional field to which the drawing belongs; drawing type can be used to represent whether the drawing is a floor plan, elevation, section, system diagram, detail drawing, etc.; floor information can be used to represent the floor, basement, roof, machine room, or standard floor range corresponding to the drawing.
[0126] For example, the system first standardizes the first, second, and third attribute information, mapping attribute labels from different sources to a unified label space. Then, it establishes a candidate set for each attribute dimension and summarizes the candidate values and confidence levels corresponding to each information source.
[0127] In one possible embodiment, a linear weighted approach can be used for fusion. For a candidate attribute value v, the comprehensive score Score(v) = w1×P1(v) + w2×P2(v) + w3×P3(v) is calculated, where P1(v) represents the path matching confidence of candidate value v in the first attribute information, P2(v) represents the text recognition confidence of candidate value v in the second attribute information, P3(v) represents the visual recognition confidence of candidate value v in the third attribute information, w1, w2, and w3 represent the fusion weights of the three information sources, and w1+w2+w3 can be set to 1. The purpose of this formula is to map the evidence strength from different sources to a unified scale for comparison, thereby selecting the candidate value with the highest comprehensive score as the final output of the current attribute dimension. Understandably, if the path naming in the system deployment scenario is relatively standardized, w1 can be appropriately increased; if the drawing title block is standardized and the text is clear, w2 can be appropriately increased; if the processed objects are mostly scanned documents or files with missing paths, w3 can be appropriately increased or a scenario-adaptive weight adjustment strategy can be introduced.
[0128] In addition to static weights, the effective weights of each information source can be dynamically adjusted based on the actual quality of the current drawing. For example, when the relative path is too short or contains only meaningless numbers or project codes, the system reduces the weight of path information; when the effective text length in the OCR recognition result is short, the field distribution is abnormal, or the average recognition confidence is below the threshold, the system reduces the weight of text information; when the second image has insufficient resolution or the drawing is severely damaged, resulting in an excessively high entropy value output by the visual model, the system reduces the weight of visual information.
[0129] Dynamic adjustments can be achieved through rules or by training a fusion decision model that automatically outputs w1, w2, and w3 based on the input quality indicators.
[0130] After obtaining the professional category, drawing type, and floor number information, the system encapsulates it into a drawing information record and stores it in association with the drawing file identifier, page number, project number, original path, processing time, and version number. This drawing information can be written to a relational database, retrieval index, document metadata table, or the data service interface of the BIM collaboration platform to support quick querying and retrieval by professional category, drawing type, and floor.
[0131] This step is crucial for solving the technical problem of stable output of drawing information in multi-source, heterogeneous drawing scenarios in architectural engineering. Its implementation principle lies in no longer treating any single source—path, text, or visual—as the sole criterion, but instead transforming the complementarity of the three information sources into a unified judgment capability through weighted fusion. When the catalog path of a drawing is standardized but the image is blurry, the system can still obtain high-quality results relying on the path information; when the path naming is not standardized but the title text is clear, the system can use text information to correct the classification; when both the path and text are incomplete but the drawing layout characteristics are obvious, the system can complete the drawing type identification through a visual model. Therefore, weighted fusion processing enables each information source to compensate for each other under different quality conditions, reducing the probability of misjudgment caused by missing single information, misidentification, or noise, and improving the recognition stability, completeness, and adaptability in the management of complex engineering drawings.
[0132] This application provides a method for determining the graphic information of a drawing file, including acquiring the drawing file of an architectural project, acquiring the relative path of the drawing file, and performing image conversion processing on the drawing file to obtain a first image and a second image; performing matching processing based on the relative path in a preset path feature library to obtain first attribute information; performing text conversion processing on the first image to obtain second attribute information; performing recognition processing on the second image based on an intelligent model to obtain third attribute information; and performing weighted fusion processing on the first attribute information, second attribute information, and third attribute information to obtain the graphic information of the drawing file. In this embodiment, through the collaborative extraction and fusion decision of relative path, text content, and visual features, an integrated recognition process for multi-source heterogeneous drawings of architectural projects is constructed, enabling the drawing file to output professional category, drawing type, and layer information when the completeness and credibility of various information are different, thereby improving the accuracy, stability, and usability of the graphic information determination in engineering applications.
[0133] Figure 2 A flowchart illustrating a method for determining image information of an image file provided in this application embodiment. Figure 2 ,like Figure 2 As shown, in this embodiment... Figure 1 Based on the embodiments, a method for determining the image information of an image file is described in detail. The method includes:
[0134] S201. Obtain the drawing file of the architectural project; and perform image conversion processing on the drawing file to obtain the first image and the second image.
[0135] For example, this step can be referred to step S101, and will not be described again.
[0136] In one example, the drawing file of the architectural project is obtained; the drawing file is cropped to obtain the effective area of the drawing file; the effective area of the drawing file is converted to obtain the first image and the second image.
[0137] For example, obtain the drawing files of the building project.
[0138] For example, the effective area of a drawing file refers to the main page area remaining after removing the edge blank areas, header and footer areas, and binding blank areas that are irrelevant to subsequent image recognition. This area usually includes the title block, drawing name, floor labels, professional descriptions, and main graphic lines, and can serve as effective input for subsequent text conversion processing and visual recognition processing.
[0139] Cropping can be implemented based on the page boundaries, frame boundaries, or content distribution boundaries of the image file. It determines the outer range of the effective layout by detecting areas with significant changes in continuous pixels in the image, and removes the invalid parts on the periphery to reduce noise interference and subsequent computation.
[0140] The format conversion process is used to convert the cropped effective area into different image representations. The first image and the second image can be generated from the same effective area respectively. The first image maintains a higher resolution to extract text details, while the second image uses a lower resolution or an image format suitable for model input to perform visual feature recognition. In practical applications, the image conversion process can also be combined with color space conversion, compression rate adjustment, or bit depth adjustment to adapt to the input requirements of different recognition modules. This application embodiment does not limit this.
[0141] For example, the cropped effective area is first normalized to a uniform size, and then two image representations are generated respectively. This preserves the core content of the drawing while enabling the text recognition module to obtain clearer character boundaries, allowing the intelligent model to obtain input data more suitable for feature extraction. Because irrelevant areas are removed in advance, background information unrelated to drawing attribute judgment is significantly reduced in the first and second images, avoiding interference from blank edges on layout features and text positioning. This processing method allows the same drawing file to correspond to image inputs of different resolutions in different recognition stages, thereby improving the stability and accuracy of drawing information extraction and reducing the sensitivity of subsequent recognition to the scanning quality of the original drawing file.
[0142] S202. Obtain the relative path of the image file; perform matching processing in the preset path feature library based on the relative path to obtain the first attribute information.
[0143] For example, obtaining the relative path of a graph file includes: obtaining the absolute path of the graph file; wherein the absolute path represents the complete address information of the graph file on the storage device starting from the root directory; and determining the relative path based on the absolute path.
[0144] For example, an absolute path refers to the complete location information of a graph file in the file system. It is usually composed of the root directory, several levels of directories, and the file name, and can uniquely indicate the storage location of the graph file on the storage device.
[0145] Relative path refers to the path information obtained by compressing and expressing the hierarchical relationship of the drawing file under the preset base directory. It is used to characterize the positional relationship of the drawing file relative to the project directory, engineering directory or other preset directory base, which facilitates subsequent path matching and attribute extraction.
[0146] For example, the system first reads the absolute path corresponding to the graph file from the file system, object storage, or distributed storage service. The absolute path can be obtained through file handle lookup, directory index retrieval, or storage metadata reading. The obtained path information includes directory names and file identifiers that expand level by level starting from the root directory.
[0147] The system, based on a pre-configured baseline directory, removes the root directory identifier, common prefix directory, or fixed mount path from the absolute path, retaining only the remaining path fragments that represent the directory hierarchy, thus obtaining the relative path. If the graph file is stored in a cloud file system, a unified namespace resolution method can also be used to map the logical address to a relative path, ensuring that similar graph files on different storage nodes have a consistent path representation. In practical applications, this path conversion module can also work with a directory normalization component to uniformly process path separators, case differences, and redundant jump directories; this embodiment does not limit this aspect.
[0148] First, the precise location of the drawing file in the storage medium is obtained using the absolute path. Then, it is converted into a relative path relative to a preset base directory. This frees the path information from the limitations of the specific storage environment while retaining the directory hierarchy features that can be used for semantic matching. In this way, subsequent matching of directory semantics related to drawing discipline, drawing type, or layer number can be performed based on the relative path, thereby improving the stability of drawing information determination.
[0149] With this implementation, the location information of drawing files can participate in subsequent identification and processing in a unified relative expression form, avoiding the environmental coupling problem caused by relying solely on filenames or absolute addresses, improving the adaptability across storage systems and project directories, and enhancing the parsability and consistency of drawing path information.
[0150] For example, the process of determining the first attribute information can be found in step S102, and will not be described again.
[0151] S203. Perform text recognition processing on the first image to obtain a text list; filter the text list based on matching rules to obtain target image and text information; perform matching processing on the target image and text information based on a preset image and text database to obtain second attribute information.
[0152] The process involves filtering a text list based on matching rules to obtain target text and image information. This includes: filtering the text list based on a preset first matching rule to obtain candidate text data; merging the candidate text data to obtain merged candidate text data; filtering the merged candidate text data based on a preset second matching rule to obtain target text data. The preset first matching rule is a regular expression matching rule based on preset keywords; the preset second matching rule is a rule based on text format filtering; and determining the target text and image information based on the target text data.
[0153] For example, the text list may include drawing names, professional abbreviations, floor identifiers, scale information, and design descriptions, which facilitates subsequent semantic filtering.
[0154] The matching rules can be composed of a preset set of keywords, regular expressions, and text layout constraints. They are used to filter out noisy text that is irrelevant to the drawing attributes from the text list and retain the target graphic information that can represent the drawing category and floor information.
[0155] For example, a pre-defined image-text database is used to store the correspondence between drawing attributes and image-text features. This database can pre-establish associated entries between professional categories, drawing types, floor markers, and typical text patterns. When matching target image-text information with the pre-defined image-text database, comparisons can be made based on text keywords, character combinations, layout positions, and semantic features, thereby outputting second attribute information corresponding to the target image-text information. This second attribute information can characterize the drawing's professional category, drawing type, or floor number information, and can be used for subsequent image-text fusion processing.
[0156] For example, text recognition processing can employ an OCR recognition engine to perform regional recognition on the first image, or it can first segment the first image and then recognize the segmented text regions separately to reduce the interference of complex backgrounds on the recognition results. Matching rules can be preset based on common naming conventions of architectural drawings, such as matching professional abbreviations like "architectural drawings," "structural drawings," "hydraulic drawings," and "electrical drawings," matching type terms like "floor plan," "section drawing," and "detail drawing," and recognizing floor labels like "1F," "2F," and "roof." The preset image and text database can be implemented using a relational database, key-value database, or vector retrieval database. When the target image and text information matches the standard image and text features in the database, the corresponding second attribute information is output.
[0157] The text information in the first image can be converted into a structured text list, then the valid text and image information can be filtered out using matching rules and verified against a text and image database, thereby improving the accuracy and stability of the second attribute information extraction. This processing method can effectively reduce the impact of scanning noise, missing text, and layout differences on the recognition results, making drawing attribute acquisition more suitable for batch management and automatic classification scenarios of architectural engineering drawings.
[0158] Figure 3 This is a flowchart illustrating step S203 of a method for determining image information in an image file provided in an embodiment of this application. Figure 3 As shown, step S203 includes:
[0159] S2031. Perform text extraction processing on the first image to obtain the coordinates of the character text boxes; expand the character text boxes outward by a preset pixel distance from their coordinates to obtain other character text boxes that intersect with the character text boxes; perform clustering processing on the other intersecting character text boxes to obtain first text information; if it is determined that the amount of data of the first text information is less than a preset threshold, then determine to perform optical character recognition processing on the first image to obtain second text information; perform fusion processing and deduplication processing on the first text information and the second text information to obtain third text information.
[0160] The third text information is then subjected to confidence filtering and sorting processes to obtain a text list.
[0161] For example, a character text box is used to represent the image area where a single character or combination of characters is located in the first image. The coordinates of the character text box can be the coordinates of the top left corner, bottom right corner, or center point, used to describe its spatial position. A preset pixel distance is used to determine the extension range of adjacent text boxes.
[0162] For example, text detection is first performed on the first image to obtain multiple character text boxes, and the coordinates of the top-left corner, bottom-right corner, and center of each character text box are recorded. Then, a preset pixel distance is expanded outward based on the center coordinates. This distance can typically be set to several to tens of pixels depending on the resolution of the first image to cover spatially adjacent and coherent character areas. When performing clustering and merging on other character text boxes that intersect with the current character text box within the expanded range, clustering rules based on distance thresholds or overlap rate thresholds can be used to merge character boxes belonging to the same text line or the same text block into the first text information.
[0163] If the number of characters, text boxes, or text segments contained in the first text information is lower than a preset threshold, it indicates that there may be omissions in the current extraction results, thereby triggering optical character recognition processing to supplement the second text information. The fusion processing can merge the first and second text information and perform deduplication based on character position, character content consistency, or string similarity to form the third text information.
[0164] Obtain the character confidence score of each text element in the third text information, remove text elements with a confidence score lower than the first confidence score threshold, and then sort the remaining text elements according to their spatial coordinates to form a text list that conforms to the image reading order.
[0165] By employing a dual-path approach of text extraction and OCR supplementation, initial text information can be directly generated when character detection is relatively complete. When character detection is sparse or missing, OCR results are automatically introduced for reinforcement. Furthermore, through fusion deduplication, confidence filtering, and spatial sorting, the completeness, uniqueness, and orderliness of the text list are improved. For common issues in architectural engineering drawings such as scattered annotations, overlapping annotations, and partial missing characters, this method can reduce text omissions and minimize the impact of misidentification on subsequent text-image matching, thereby improving the stability and accuracy of determining image information in drawing documents.
[0166] S2032. Obtain the character confidence score and spatial coordinates of each text element in the third text information; the text element is a single character or a text segment formed by clustering; based on a preset first confidence threshold, remove text elements with character confidence scores lower than the first confidence threshold to form a first filter set; for the text elements in the first filter set, merge them in the same row or column according to their spatial coordinates to obtain multiple text segments, and calculate the average confidence score of each text segment; based on a preset second confidence threshold, remove text segments with average confidence scores lower than the second confidence threshold to form a second filter set; sort the text segments in the second filter set according to a preset spatial sorting rule, the spatial sorting rule including first arranging them in row order from top to bottom, and then arranging them in column order from left to right within the same row, and determine the sorted set of text segments as a text list.
[0167] For example, text elements are used as the basic units for confidence judgment and spatial reconstruction. Character confidence represents the reliability of the text element being correctly identified, and spatial coordinates are used to describe its positional relationship in the image, facilitating subsequent row-by-row or column-by-column merging and spatial sorting. The first confidence threshold and the second confidence threshold are used to control the quality screening at the element level and paragraph level, respectively. The first filter set and the second filter set represent the set of text elements and the set of text paragraphs after two confidence filtering processes, respectively. The text list represents the final ordered set of text used for subsequent image-text matching.
[0168] For example, after receiving the third text information, the system first reads the character confidence score and bounding box coordinates corresponding to each text element. The character confidence score can be output by an optical character recognition model or a text extraction model, and the spatial coordinates can be represented by the coordinates of the upper left corner, lower right corner, or center point of the text box.
[0169] Text elements with character confidence scores below the first confidence threshold are directly discarded to prevent low-confidence characters from entering the subsequent merging process. For the retained text elements, their spatial coordinates are used to determine the adjacency relationship in the row and column directions. When multiple text elements are within the preset line spacing and have continuous horizontal arrangement characteristics, they are determined to be in the same row and merged into the same text paragraph. When multiple text elements are within the preset column spacing and have continuous vertical arrangement characteristics, they are determined to be in the same column and merged into the same text paragraph. The average confidence score of each text paragraph can be obtained by calculating the arithmetic mean of the character confidence scores of each text element in the paragraph, or by weighting by the number of characters to reflect the overall recognition reliability of the paragraph. When the average confidence score is below the second confidence threshold, the text paragraph is discarded. The retained text paragraphs are then sorted according to the row order from top to bottom and the column order from left to right within the same row to obtain a text list consistent with the page reading order, thus outputting a structured text result.
[0170] This processing method reduces the impact of single-character misidentification and fragment mis-splitting on the results through two-level confidence screening, improves the integrity of broken text by merging the same row or column based on spatial coordinates, and ensures that the text list is consistent with the original layout through spatial sorting, so that subsequent image-text matching can be performed based on more stable and standardized text content.
[0171] By adopting the above method, low-confidence text elements and low-confidence text paragraphs can be effectively eliminated, reducing the interference of noisy text on drawing attribute matching. At the same time, discrete texts are reorganized into a text list that conforms to reading habits, improving the integrity, continuity and usability of text information, thereby enhancing the recognition stability and matching accuracy in the process of determining drawing information.
[0172] S2033. Based on the preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is merged to obtain merged candidate text data; based on the preset second matching rule, the merged candidate text data is filtered to obtain target text data; based on the target text data, the target graphic information is determined.
[0173] The first preset matching rule is a regular expression matching rule based on preset keywords; the second preset matching rule is a rule based on text format filtering.
[0174] For example, the first preset matching rule uses a regular expression matching method based on preset keywords to perform pattern recognition on the character sequences in the text list in order to extract candidate text data from texts containing feature information such as drawing name, professional category, drawing number, floor number, etc.
[0175] Merging is used to connect candidate texts that are scattered in different text boxes but have a continuous relationship. For example, it can merge texts that are identified as multiple fragments in the same line into a complete string in spatial order, or combine short texts that have a dependency relationship into a complete semantic unit to improve the effectiveness of subsequent filtering.
[0176] The second preset matching rule adopts a text format-based filtering rule to judge the format consistency of the merged candidate text data. For example, it judges whether it meets the preset length range, character composition, separator form or layer number representation format, thereby eliminating content that does not conform to the drawing attribute expression.
[0177] For example, regular expression matching can be performed on the text list first to retain text fragments that contain preset keywords and meet the matching pattern. Then, adjacent fragments are merged in a preset order to form merged candidate text data. Subsequently, the data is filtered a second time according to text format rules to obtain target text data. Finally, the target text data is mapped to target graphic information.
[0178] By adopting the above-mentioned hierarchical filtering and merging mechanism, the integrity and accuracy of effective text can be improved, and false and missed matches can be reduced when there are breaks, noise or inconsistent formats in the text recognition results. This improves the stability of the determination of target graphic information and enhances the adaptability of the graphic information extraction results to complex architectural engineering drawing scenarios.
[0179] S2034. Match the target image and text information based on the preset image and text database to obtain the second attribute information.
[0180] For example, this step can be referred to step S203, and will not be repeated here.
[0181] Understandably, the pre-defined image and text database can store corresponding relationships such as "drawing name - professional category", "drawing number feature - drawing type", and "floor marker - floor number information". The database can adopt a relational storage structure or a key-value mapping structure to facilitate rapid retrieval and matching of target image and text information. After matching is completed, the output second attribute information can be used as the source of text attributes in subsequent image and text information fusion processing.
[0182] S204. Binarize the second image to obtain the target image; input the target image into the intelligent model, process the target image based on the intelligent model, and obtain the third attribute information output by the intelligent model.
[0183] The intelligent model is obtained by fine-tuning the parameters of the initial model based on the training dataset; the training dataset includes historical drawing files of architectural projects with pre-labeled drawing type tags.
[0184] For example, the second image can be a low-resolution image obtained from an image file through image conversion, which has low pixel contrast and contains more background interference information. Binarization processing refers to setting a threshold based on the pixel grayscale distribution to map the pixels in the second image into two value states, thereby forming the target image.
[0185] The target image can preserve the outline, lines, title block boundaries, and significant structure of the annotation area of the drawing, while suppressing grayscale noise and complex background textures, making it easier for intelligent models to extract stable visual features.
[0186] The intelligent model can be a convolutional neural network, a lightweight classification network, or a deep learning model with image structure recognition capabilities. Its training data can include image samples from different professional categories, drawing types, and floor signs. After the target image is input into the intelligent model, the model outputs third attribute information based on convolutional features, spatial layout features, and symbol distribution features. The third attribute information may include drawing type, professional category, or corresponding confidence level. Other models can also be selected for practical applications, and this application embodiment does not limit this.
[0187] For example, the system first binarizes the second image, making the lines, borders, and text regions form a clearer binary distribution at the pixel level. Then, the processed target image is fed into a trained intelligent model for inference. The model completes the category determination based on the graphic structure in the binary image and outputs the third attribute information. Because binarization reduces grayscale fluctuations and background interference in the original image, the intelligent model can focus more on the main features of the drawing, thereby improving the stability of recognizing the drawing layout, line structure, and symbol features.
[0188] After adopting this implementation method, irrelevant grayscale information in the second image is effectively suppressed, the input features of the intelligent model are more prominent, and the sensitivity of the recognition results to scanning quality, base map complexity and text background interference is reduced. This improves the output accuracy and robustness of the third attribute information and helps to improve the determination accuracy of professional category, drawing type and layer number information when fusion of subsequent image information.
[0189] In one example, a training dataset is obtained; the training dataset is processed to obtain processed images; the processed images are input into the initial model for further processing to obtain historical feature vectors and classification results; based on the classification results and drawing type labels, a task loss function is determined; based on the historical feature vectors, a contrastive loss function is determined; the weighted sum of the task loss function and the contrastive loss function is used as the total loss to perform backpropagation on the initial model; during backpropagation, the parameters of the shallow convolutional layers of the initial model are frozen, and the parameters of the deep convolutional layers and the attention module corresponding to the attention mechanism of the initial model are updated to obtain the intelligent model.
[0190] The contrastive loss function is used to constrain the feature vector distance between drawings of the same type to be less than the feature vector distance between drawings of different types.
[0191] For example, the training dataset includes historical drawing files with completed drawing type annotations. Drawing type labels represent the category to which architectural engineering drawings belong. The initial model can be a neural network model with convolutional feature extraction capabilities and an integrated attention mechanism. Historical feature vectors represent the semantic distribution of images in the model's feature space, and the classification results are used to output the predicted category of the drawing type. Processed images are typically obtained through format standardization, size scaling, grayscale normalization, and pixel standardization to ensure that the input data meets the numerical range and spatial size requirements for model training.
[0192] For example, the images in the training dataset are first preprocessed to form processed images that can be directly input into the initial model. Then, the initial model performs forward computation on the images, outputting the corresponding historical feature vectors and classification results. When calculating the task loss function based on the classification results and the drawing type labels, cross-entropy loss can be used to represent the deviation between the predicted category and the true label. When determining the contrastive loss function based on the historical feature vectors, the feature vectors of drawings of the same type can be brought closer together, while the feature vectors of drawings of different types can be spaced further apart, thereby forming a more compact cluster distribution of samples of the same category in the feature space. The task loss function and the contrastive loss function are weighted according to preset weights to form the total loss, and the total loss drives the initial model for backpropagation.
[0193] During backpropagation, the parameters of shallow convolutional layers are frozen to preserve the model's general ability to extract edges, textures, and basic graphic structures. The parameters of deep convolutional layers and the attention module are updated to better adapt the model to the high-level semantic features and key area attention mechanisms in architectural drawings. The intelligent model obtained through this fine-tuning method can improve its ability to distinguish different drawing types while retaining its general visual representation capabilities, and enhance its adaptability to complex drawing styles, partial occlusion, and layout differences.
[0194] When working on drawing recognition tasks, this intelligent model first triggers forward inference from the input image, and then outputs discrimination information related to the drawing type based on deep semantics and attention focusing results. Because task loss and contrast loss are introduced simultaneously during training, the model not only learns the category boundaries, but also learns intra-category consistency and inter-category separability. Therefore, it can still maintain relatively stable recognition performance when faced with architectural engineering drawings from different sources and with different formats.
[0195] This model can utilize label supervision and feature space constraints for collaborative optimization during the training phase, reducing the inter-class confusion problem that easily occurs when relying solely on classification loss. At the same time, freezing shallow convolutional layers can reduce the risk of overfitting and maintain the stability of basic visual features, enabling the trained intelligent model to have better generalization ability and classification robustness in drawing type recognition.
[0196] S205. Based on the professional category and its confidence level of the first attribute information and the professional category and its confidence level of the second attribute information, determine the professional category of the drawing information; based on the drawing type and its confidence level of the first attribute information, the drawing type and its confidence level of the second attribute information, and the drawing type and its confidence level of the third attribute information, determine the drawing type of the drawing information; based on the layer number information and its confidence level of the first attribute information and the layer number information and its confidence level of the second attribute information, determine the layer number information of the drawing information.
[0197] The information includes at least one of the following: architectural engineering professional category, drawing type, and number of floors; the first attribute information includes one of the following: professional category, drawing type, and number of floors, and its confidence level; the second attribute information includes at least one of the following: professional category, drawing type, and number of floors, and its confidence level; and the third attribute information includes at least the following: drawing type and its confidence level.
[0198] For example, the drawing information is used to characterize the structured identification results of architectural engineering drawing files. The professional category may refer to one or more of architecture, structure, water supply and drainage, electrical, HVAC or fire protection. The drawing type may refer to one or more of floor plan, elevation, section, detail or system diagram. The floor number information may refer to basement, standard floor, first floor, roof floor or specific floor number.
[0199] Confidence score is used to characterize the credibility of corresponding attribute information. It is usually obtained by combining the matching hit rate, the output probability of the recognition model, or the rule score, so as to allocate weights when there is information conflict.
[0200] For example, the first attribute information can be obtained by extracting the path semantics of the image file relative to the base directory, the second attribute information can be obtained by matching the image text recognition result with the preset image text database, and the third attribute information can be obtained by recognizing the image visual features input into the intelligent model.
[0201] When independently fusing information on professional categories, drawing types, and layer numbers, a weighted score can be constructed based on the confidence level of each attribute. Multiple candidate results for the same attribute are compared, and the one with the highest comprehensive score is selected as the output result. When an attribute appears only in some information sources, the corresponding valid result can be directly adopted, and low-confidence noise can be suppressed by combining confidence levels. The above weighted fusion can be completed by a processing unit in the server. The processing unit can be a processor and its executable program. The storage unit is used to store the attribute weight table, threshold table, and drawing category mapping relationship. In practical applications, other models of this component can also be selected, and this embodiment does not limit this.
[0202] By using path attributes, text attributes, and visual attributes to determine professional categories, drawing types, and floor number information, and by weighted fusion of similar attributes from different sources, high recognition consistency can be maintained even when file naming is not standardized, title blocks are missing, or image recognition is unstable. This method allows drawing information to be used not only for subsequent classification, storage, and retrieval, but also for floor association, professional association, and version comparison, thereby improving the accuracy, robustness, and automation of architectural engineering drawing management.
[0203] This application provides a method for determining the image information of a drawing file. The method involves acquiring an architectural engineering drawing file and sequentially cropping and converting it to obtain a first image and a second image. A relative path is derived based on the absolute path of the drawing file, and a path feature library is matched to obtain first attribute information. Then, text recognition and filtering of the first image are performed to obtain target image-text information, which is matched with an image-text database to obtain second attribute information. Simultaneously, the second image is binarized and input into an intelligent model to obtain third attribute information. Finally, the professional category, drawing type, floor number information, and corresponding confidence levels of the three attribute information are combined to comprehensively determine the corresponding information of the drawing. By integrating multi-dimensional data such as path features, text-image-text, and intelligent image recognition, and combining confidence levels for comprehensive judgment, the accuracy and completeness of architectural engineering drawing information recognition are effectively improved, achieving the effect of efficiently and accurately determining the complete image information of architectural engineering drawings.
[0204] Figure 4 A schematic diagram of the structure of a device for determining image information of an image file provided in an embodiment of this application. Figure 1 ,like Figure 4 As shown, the image information determination device 40 for an image file provided in this embodiment includes:
[0205] The acquisition module 401 is used to acquire the drawing files of the architectural project; acquire the relative path of the drawing files; and perform image conversion processing on the drawing files to obtain a first image and a second image; wherein, the relative path represents the path information of the drawing files relative to a preset base directory; the image resolution of the first image is higher than that of the second image;
[0206] The processing module 402 is used to perform matching processing based on the relative path in a preset path feature library to obtain first attribute information; perform text conversion processing on the first image to obtain second attribute information; and perform recognition processing on the second image based on an intelligent model to obtain third attribute information; wherein, the first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text of the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image.
[0207] The fusion module 403 is used to perform weighted fusion processing on the first attribute information, the second attribute information, and the third attribute information to obtain the drawing information of the drawing file; the drawing information is used to indicate the professional category, drawing type, and number of floors of the drawing file of the architectural project.
[0208] This embodiment provides a device for determining the image information of an image file, which can execute the method provided in the above-described method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0209] Figure 5 A schematic diagram of the structure of a device for determining image information of an image file provided in an embodiment of this application. Figure 2 ,like Figure 5 As shown, the image information determination device 50 for an image file provided in this embodiment includes:
[0210] The acquisition module 501 is used to acquire the drawing files of the architectural project; acquire the relative path of the drawing files; and perform image conversion processing on the drawing files to obtain a first image and a second image; wherein, the relative path represents the path information of the drawing files relative to a preset base directory; the image resolution of the first image is higher than that of the second image;
[0211] The processing module 502 is used to perform matching processing based on the relative path in a preset path feature library to obtain first attribute information; perform text conversion processing on the first image to obtain second attribute information; and perform recognition processing on the second image based on an intelligent model to obtain third attribute information; wherein, the first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text of the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image.
[0212] The fusion module 503 is used to perform weighted fusion processing on the first attribute information, the second attribute information, and the third attribute information to obtain the drawing information of the drawing file; the drawing information is used to indicate the professional category, drawing type, and number of floors of the drawing file of the architectural project.
[0213] In one possible implementation, the processing module 502 includes:
[0214] Perform text recognition processing on the first image to obtain a text list;
[0215] Based on matching rules, the text list is filtered to obtain the target image and text information;
[0216] The target image and text information is matched and processed based on a preset image and text database to obtain the second attribute information.
[0217] In one possible implementation, the first image undergoes text recognition processing to obtain a text list, including:
[0218] The first image is processed to extract text, and the coordinates of the character text boxes are obtained. The character text boxes are expanded outward by a preset pixel distance from their coordinates to obtain other character text boxes that intersect with them. The other intersecting character text boxes are clustered to obtain the first text information.
[0219] If it is determined that the amount of data in the first text information is less than a preset threshold, then it is determined that optical character recognition processing is performed on the first image to obtain the second text information; the first text information and the second text information are then fused and deduplicated to obtain the third text information.
[0220] The third text information is then subjected to confidence filtering and sorting processes to obtain a text list.
[0221] In one possible implementation, the third text information is sequentially subjected to confidence filtering and sorting processes to obtain a text list, including:
[0222] Obtain the character confidence score and spatial coordinates of each text element in the third text information; the text element is a single character or a text fragment formed by clustering;
[0223] Based on a preset first confidence threshold, text elements with a character confidence level lower than the first confidence threshold are removed to form a first filter set;
[0224] For the text elements in the first filter set, they are merged in the same row or column according to their spatial coordinates to obtain multiple text paragraphs, and the average confidence of each text paragraph is calculated.
[0225] Based on a preset second confidence threshold, text segments with an average confidence level lower than the second confidence threshold are removed to form a second filter set;
[0226] According to the preset spatial sorting rules, the text paragraphs in the second filter set are sorted. The spatial sorting rules include first arranging them in the order of rows from top to bottom, and then arranging them in the order of columns from left to right within the same row. The sorted set of text paragraphs is then determined as a text list.
[0227] In one possible implementation, the text list is filtered to obtain the target image and text information, including:
[0228] Based on the preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is then merged to obtain merged candidate text data.
[0229] Based on the preset second matching rule, the merged candidate text data is filtered to obtain the target text data; wherein, the preset first matching rule is a regular expression matching rule based on preset keywords; and the preset second matching rule is a rule based on text format filtering.
[0230] Based on the target text data, determine the target graphic and text information.
[0231] In one possible implementation, the processing module 502 includes:
[0232] The second image is binarized to obtain the target image;
[0233] The target image is input into the intelligent model, and the target image is processed based on the intelligent model to obtain the third attribute information output by the intelligent model. The intelligent model is obtained by fine-tuning the parameters of the initial model based on the training dataset. The training dataset includes historical drawing files of architectural engineering with pre-labeled drawing type tags.
[0234] In one possible implementation, the intelligent model is obtained by fine-tuning the parameters of an initial model based on a training dataset, including:
[0235] Obtain the training dataset; process the training dataset to obtain processed images; input the processed images into the initial model for further processing to obtain historical feature vectors and classification results;
[0236] Based on the classification results and drawing type labels, a task loss function is determined; based on historical feature vectors, a comparison loss function is determined; wherein, the comparison loss function is used to constrain the feature vector distance of drawings of the same type to be less than the feature vector distance of drawings of different types.
[0237] The initial model is backpropagated using the weighted sum of the task loss function and the contrastive loss function as the total loss.
[0238] During backpropagation, the parameters of the shallow convolutional layers of the initial model are frozen, and the parameters of the deep convolutional layers and the attention modules corresponding to the attention mechanism of the initial model are updated to obtain the intelligent model.
[0239] In one possible implementation, the drawing information includes at least one of the following: the professional category of the architectural project, the drawing type, and the number of floors; the first attribute information includes one of the professional category, the drawing type, and the number of floors, and their confidence levels; the second attribute information includes at least one of the professional category, the drawing type, and the number of floors, and their confidence levels; the third attribute information includes at least the drawing type and its confidence level; the fusion module 503 includes:
[0240] Based on the professional categories and their confidence levels of the first attribute information and the professional categories and their confidence levels of the second attribute information, the professional categories of the graph information are determined.
[0241] The drawing type of the drawing information is determined based on the drawing type and its confidence level of the first attribute information, the drawing type and its confidence level of the second attribute information, and the drawing type and its confidence level of the third attribute information.
[0242] The layer number information of the graph information is determined based on the layer number information and its confidence level of the first attribute information and the layer number information and its confidence level of the second attribute information.
[0243] In one possible implementation, the acquisition module 501 includes:
[0244] Obtain the absolute path of the graph file; where the absolute path represents the complete address information of the graph file on the storage device, starting from the root directory;
[0245] Determine the relative path based on the absolute path.
[0246] In one possible implementation, the acquisition module 501 includes:
[0247] The image file is cropped to obtain the valid area of the image file;
[0248] The effective area of the image file is converted to obtain the first image and the second image.
[0249] This embodiment provides a device for determining the image information of an image file, which can execute the method provided in the above-described method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0250] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 60 provided in this embodiment includes at least one processor 601 and a memory 602. Optionally, the device 60 further includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus 604.
[0251] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to perform the above-described method.
[0252] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0253] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0254] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0255] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0256] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0257] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0258] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0259] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0260] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0261] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0262] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0263] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0264] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0265] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for determining the image information of an image file, characterized in that, include: Obtain the architectural drawings; Obtain the relative path of the image file; and perform image conversion processing on the image file to obtain a first image and a second image; wherein, the relative path represents the path information of the image file relative to a preset base directory; the image resolution of the first image is higher than that of the second image; Based on the relative path, a matching process is performed in a preset path feature library to obtain first attribute information; the first image is processed by text conversion to obtain second attribute information; the second image is processed by recognition based on an intelligent model to obtain third attribute information; wherein, the first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text of the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image. The first attribute information, the second attribute information, and the third attribute information are weighted and fused to obtain the drawing information of the drawing file. The drawing information is used to indicate the professional category, drawing type, and number of floors of the drawing file of the architectural project.
2. The method according to claim 1, characterized in that, The first image is subjected to text conversion processing to obtain second attribute information, including: The first image is subjected to text recognition processing to obtain a text list; Based on a preset first matching rule, the text list is filtered to obtain candidate text data; the candidate text data is then merged to obtain merged candidate text data. Based on a preset second matching rule, the merged candidate text data is filtered to obtain target text data; wherein, the preset first matching rule is a regular expression matching rule based on preset keywords; and the preset second matching rule is a rule based on text format filtering. Based on the target text data, target image and text information is determined; the target image and text information is matched and processed based on a preset image and text database to obtain the second attribute information.
3. The method according to claim 2, characterized in that, The first image is subjected to text recognition processing to obtain a text list, including: The first image is processed to extract text, and the coordinates of the character text boxes are obtained. The character text boxes are expanded outward by a preset pixel distance from their coordinates to obtain other character text boxes that intersect with the character text boxes. The other intersecting character text boxes are clustered to obtain the first text information. If it is determined that the amount of data in the first text information is less than a preset threshold, then it is determined that optical character recognition processing is performed on the first image to obtain the second text information; the first text information and the second text information are fused and deduplicated to obtain the third text information. The third text information is sequentially subjected to confidence filtering and sorting processes to obtain the text list.
4. The method according to claim 3, characterized in that, The third text information is sequentially subjected to confidence filtering and sorting processes to obtain the text list, including: Obtain the character confidence score and spatial coordinates of each text element in the third text information; the text element is a single character or a text fragment formed by clustering; Based on a preset first confidence threshold, text elements whose character confidence is lower than the first confidence threshold are removed to form a first filter set; For the text elements in the first filter set, they are merged in the same row or column according to the spatial coordinates to obtain multiple text paragraphs, and the average confidence of each text paragraph is calculated. Based on a preset second confidence threshold, text segments with an average confidence level lower than the second confidence threshold are removed to form a second filter set; According to the preset spatial sorting rules, the text paragraphs in the second filter set are sorted. The spatial sorting rules include first arranging them in a top-to-bottom row order, and then arranging them in a left-to-right column order within the same row. The sorted set of text paragraphs is then determined as the text list.
5. The method according to claim 1, characterized in that, The second image is processed using an intelligent model to obtain third attribute information, including: The second image is binarized to obtain the target image; The target image is input into the intelligent model, and the target image is processed based on the intelligent model to obtain the third attribute information output by the intelligent model; wherein, the intelligent model is obtained by fine-tuning the parameters of an initial model based on a training dataset; the training dataset includes historical drawing files of architectural engineering projects with pre-labeled drawing type tags; including: Obtain the training dataset; process the training dataset to obtain processed images; input the processed images into the initial model for processing to obtain historical feature vectors and classification results; the training dataset includes historical drawing files of architectural engineering projects with pre-labeled drawing type tags; Based on the classification results and the drawing type labels, a task loss function is determined; based on the historical feature vectors, a comparison loss function is determined; wherein, the comparison loss function is used to constrain the feature vector distance of drawings of the same type to be less than the feature vector distance of drawings of different types. The initial model is backpropagated using the weighted sum of the task loss function and the comparison loss function as the total loss. During backpropagation, the parameters of the shallow convolutional layers of the initial model are frozen, and the parameters of the deep convolutional layers and the attention modules corresponding to the attention mechanism of the initial model are updated to obtain the intelligent model.
6. The method according to any one of claims 1-5, characterized in that, The drawing information includes at least one of the following: professional category of architectural engineering, drawing type, and number of floors; the first attribute information includes one of the professional category, drawing type, and number of floors and its confidence level; the second attribute information includes at least one of the professional category, drawing type, and number of floors and its confidence level; and the third attribute information includes at least the drawing type and its confidence level. The first attribute information, the second attribute information, and the third attribute information are weighted and fused to obtain the graph information of the graph file, including: Based on the professional category and its confidence level of the first attribute information and the professional category and its confidence level of the second attribute information, the professional category of the graph information is determined; Based on the drawing type and its confidence level of the first attribute information, the drawing type and its confidence level of the second attribute information, and the drawing type and its confidence level of the third attribute information, the drawing type of the drawing information is determined; The layer number information of the graph information is determined based on the layer number information and its confidence level of the first attribute information and the layer number information and its confidence level of the second attribute information.
7. A device for determining image information of an image file, characterized in that, include: The acquisition module is used to acquire drawing files of architectural engineering projects; acquire the relative path of the drawing files; and perform image conversion processing on the drawing files to obtain a first image and a second image; wherein, the relative path represents the path information of the drawing files relative to a preset base directory; the image resolution of the first image is higher than that of the second image; The processing module is used to perform matching processing in a preset path feature library based on the relative path to obtain first attribute information; perform text conversion processing on the first image to obtain second attribute information; and perform recognition processing on the second image based on an intelligent model to obtain third attribute information; wherein, the first attribute information represents the drawing attribute features extracted from the relative path; the second attribute information represents the drawing attribute features extracted from the text of the first image; and the third attribute information represents the drawing attribute features extracted from the visual features of the second image. The fusion module is used to perform weighted fusion processing on the first attribute information, the second attribute information, and the third attribute information to obtain the drawing information of the drawing file; the drawing information is used to indicate the professional category, drawing type, and number of floors of the drawing file of the architectural project.
8. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-6.