Engineering drawing difference automatic comparison method and system based on image recognition and classification
By using image recognition and classification methods, the problems of low efficiency and high misjudgment rate in engineering drawing difference comparison are solved, achieving high-precision and automated drawing difference detection and classification, applicable to engineering drawing formats in different industries.
Patent Information
- Application Number
- CN202511394084.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2026-01-02
AI Technical Summary
Existing technologies are inefficient and have a high error rate in comparing differences in engineering drawings, making it difficult to automatically identify and classify the types of differences in drawings.
An image recognition and classification-based approach is adopted, including image preprocessing and registration, difference region detection and localization, feature extraction and intelligent classification, combined with a deep learning model for automatic identification of difference types.
It achieves high-precision, automated drawing difference detection and classification, significantly improving detection efficiency and accuracy, reducing manual intervention, and is applicable to engineering drawing formats in different industries.
Smart Images

Figure CN121259863A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and artificial intelligence, and particularly to a method and system for digitizing engineering drawings. Specifically, this invention is a method and system based on image processing, feature extraction, and machine learning classification algorithms for automatically detecting, locating, and classifying differences between different versions of engineering drawings. Background Technology
[0002] In engineering design fields such as architectural engineering, mechanical manufacturing, and electronic circuits, engineering drawings are the core carrier of design information. Throughout the entire lifecycle of design, review, and construction, drawings typically undergo multiple revisions and version iterations. Quickly and accurately identifying the differences between different versions of drawings is crucial for ensuring project quality, controlling change processes, and avoiding human error.
[0003] Currently, difference comparison mainly relies on the following two methods: 1. Manual comparison: Designers or reviewers visually inspect different versions of drawings. This method is extremely inefficient, labor-intensive, and prone to overlooking subtle but crucial changes due to visual fatigue, making it unsuitable for the needs of modern large-scale engineering projects. 2. Simple Automated Tool Comparison: Existing software tools (such as comparison functions within some CAD software or general image comparison tools) mostly use simple pixel-level difference or layer comparison. These methods have significant limitations: First, they are extremely sensitive to non-content-related changes in drawings, such as translation, rotation, and scaling, easily generating numerous false alarms; second, they usually only indicate "where the difference is," but cannot determine "what type of difference it is," for example, they cannot distinguish between dimension modifications and structural graphic changes, still requiring manual intervention for classification and judgment, thus lacking sufficient intelligence.
[0004] Therefore, there is an urgent need in this field for a technical solution that can automatically, accurately, and intelligently complete the detection and classification of differences in engineering drawings in order to overcome the shortcomings of existing technologies. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a method and system for automatic comparison of differences in engineering drawings based on image recognition and classification. This method can not only automatically locate discrepancy areas with high precision, but also intelligently identify the type of difference, thereby significantly improving the efficiency and accuracy of drawing review.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides an automatic comparison method for differences in engineering drawings based on image recognition and classification, comprising the following steps: S1: Image Preprocessing and Registration Input the new and old versions of the engineering drawings to be compared. First, both images are preprocessed by grayscale conversion, noise reduction, and binarization to eliminate color and noise interference. Then, an image registration algorithm based on feature points (such as SIFT, ORB, or SURF) is used to extract and match the feature points of the two images, calculating the spatial transformation matrix (such as an affine or perspective transformation matrix) between them. This transformation matrix is then used to resample and transform one image to achieve complete spatial alignment with the other, thereby eliminating translation, rotation, and scaling errors caused by drawing placement, scanning, or output. S2: Differential Region Detection and Localization The two registered images are subjected to pixel-level differencing to generate an initial differencing image. Regions with non-zero grayscale values in this differencing image are potential difference regions. Due to noise and registration residuals, the initial differencing result may contain numerous scattered points and small regions. Therefore, this invention applies morphological operations (such as closing operations to close small holes and opening operations to eliminate small protrusions) to process the differencing image and identifies independent candidate difference regions through connected component analysis. To further improve localization accuracy, a deep learning-based semantic segmentation model (such as U-Net, DeepLab, etc.) can be used to process the differencing image. After training, this model can accurately segment pixel regions belonging to true differences, effectively suppress false differences, and output a high-precision binary mask of the difference regions. S3: Differential Feature Extraction For each candidate difference region located in step S2, multi-dimensional features are extracted from the corresponding locations in both the new and old versions of the drawings to construct a feature vector for classification. The extracted features include: • Shape features: such as region moment, region area, perimeter, eccentricity, contour descriptor, etc., used to describe the geometric shape of different regions. • Texture features: such as Local Binary Pattern (LBP) and Histogram of Oriented Gradients (HOG) features, are used to describe the texture patterns within a region. • Contextual features: such as the absolute location of the difference area in the drawing, and the types of adjacent graphic elements (e.g., whether it is close to text annotations, whether it is connected to a specific line type, etc.). This feature helps to understand the semantic context of the difference. S4: Intelligent Classification of Difference Types Construct a multi-class classification model whose input is the feature vector extracted in step S3, and whose output is the label and confidence score of the difference type. The classification model can be a traditional machine learning model (such as Support Vector Machine (SVM), Random Forest, or Gradient Boosting Decision Tree) or a deep learning model (such as Multilayer Perceptron (MLP) or Convolutional Neural Network (CNN). The training process of this classification model is as follows: a. Collect a large number of engineering drawing difference samples that have been annotated by experts. Each sample contains its feature vector and the corresponding real difference type label (such as "dimension change", "graphic addition or deletion", "text modification", "annotation change", "no difference" etc.). b. Use these labeled samples to train the selected classification algorithm, and through iterative optimization, enable the model to learn the complex mapping relationship between different feature vectors and difference types. In practical applications, the feature vector of the differential region to be classified is input into this pre-trained classification model to obtain its differential category. S5: Result Generation and Output Integrating the results of the above steps generates a structured discrepancy report. The report includes, but is not limited to: the number of discrepancies, the coordinates of each discrepancy, its type, and its confidence level. Simultaneously, all discrepancy areas are visually highlighted on the original drawing image, and different colors or legends can be used to differentiate them according to their type, creating an intuitive comparison result diagram for user review. In a second aspect, the present invention provides a system for implementing the above method, the system comprising: • Image input module: Used to receive and load different versions of engineering drawing image files. • Preprocessing and registration module: Used to perform image grayscale conversion, filtering, binarization, and feature point-based image registration operations. • Difference detection module: Used to perform pixel difference, morphological processing and semantic segmentation-based fine localization, and output the coordinates of the difference region. • Feature extraction and classification module: used to extract multi-dimensional features from the difference regions and intelligently distinguish the difference types using a pre-trained classification model. • Output and Visualization Module: Used to generate structured difference report files and to perform visual annotations on drawing images.
[0007] The beneficial effects of this invention are as follows: 1. High precision and high robustness: Advanced image registration technology eliminates the impact of non-content-related changes, and combined with low-level pixel comparison and high-level semantic segmentation, it significantly improves the accuracy of difference detection and boundary localization, effectively reducing false alarms and false negatives. 2. Intelligent classification: Machine learning / deep learning models are introduced to achieve automatic semantic classification of difference types, which goes beyond simply reporting "where is different" and provides in-depth information on "what is different", greatly reducing human intervention. 3. High efficiency: The entire process is automated, and a large number of drawings can be processed in batches, making it suitable for large projects and significantly improving the efficiency of design review and version management. 4. Strong generalization ability: By training the model with a large number of samples, the system can adapt to engineering drawing formats of different industries and standards, and has good versatility and scalability. Attached Figure Description
[0008] Figure 1 This is an overall flowchart of the automatic comparison method for differences in engineering drawings provided in the embodiments of the present invention.
[0009] Figure 2 This is a schematic diagram of the image registration and difference region detection process in an embodiment of the present invention.
[0010] Figure 3 This is a flowchart illustrating the training and application process of the differential classification model in this embodiment of the invention.
[0011] Figure 4 This is a system architecture block diagram provided in an embodiment of the present invention. Detailed Implementation
[0012] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. Example: This example uses the comparison of two different versions of architectural floor plans (DWG format output as PNG images) as an example. S1: Image Preprocessing and Registration The files "Version A.png" and "Version B.png" are read into the system. They are converted to grayscale images and denoised using a Gaussian filter. Binarization is performed using the Otsu algorithm. Feature points in the two images are detected using the ORB algorithm, and feature matching is performed using Hamming distance. Based on the successfully matched feature point pairs, the affine transformation matrix is robustly estimated using the RANSAC algorithm, and this matrix is used to transform "Version B.png" to align it with "Version A.png". S2: Differential Region Detection and Localization Calculate the absolute difference map of the two aligned images. Set a threshold (e.g., 20 / 255) and set pixels with gray values below this threshold to zero in the difference map to initially filter noise. Perform closing and opening operations (using a 3x3 rectangular kernel) on the initial difference result to connect neighboring differences and eliminate small noise points. Perform connected component analysis on the processed binary image to label all connected candidate regions. For greater accuracy, crop the candidate regions and their surrounding context regions and input them into a pre-trained U-Net segmentation network (which has been trained on a labeled drawing difference dataset). The network outputs a probability map of whether each pixel represents a true difference. Thresholding is then used to obtain the final accurate difference mask. S3: Differential Feature Extraction For each precisely defined region of difference, feature extraction is performed. The seven Hu moments of that region are calculated as shape features; its LBP feature histogram is calculated as texture features; the coordinates of the region's circumscribed center are recorded as positional features; and the presence of text within a 20-pixel radius (recognized using an OCR tool) is checked as contextual features. All features are concatenated into a single feature vector. S4: Intelligent Classification of Difference Types This embodiment employs a pre-trained random forest classifier. The classifier uses 500 decision trees, and the training data contains thousands of samples labeled with categories such as "size change," "door / window addition / removal," "wall modification," "text revision," and "meaningless noise." The feature vector obtained in S3 is input into the random forest model, which outputs the probability of belonging to each category. The category with the highest probability is taken as the final classification result. S5: Result Generation and Output The system generates a JSON report recording the coordinates, type, and confidence level of all differences. Simultaneously, on "Version A.png", "Size Changes" are marked with a green box, and "Graphic Additions / Deletions" are marked with a red box. An overlay layer is also generated for users to preview and export.
[0013] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. An image recognition and classification based automatic comparison method for engineering drawing differences, characterized in that, The method comprises the following steps: S1: pre-process the input new version engineering drawing image and old version engineering drawing image, and perform image registration based on feature point matching to align the two images in space; S2: perform pixel-level difference processing on the two registered images, and combine morphological operation and connected domain analysis to preliminarily locate the candidate difference region; S3: for the candidate difference region, multi-dimensional features are extracted from shape, texture and context to form a feature vector; S4: input the feature vector into a pre-trained classification model to obtain the type classification result of the difference region; the classification model is a machine learning or deep learning model trained using a labeled engineering drawing difference sample set; S5: output a structured report containing difference position, type and confidence and / or visual comparison result.
2. The method of claim 1, wherein, In step S1, the image registration based on feature point matching specifically comprises: using SIFT, ORB or SURF algorithm to extract image feature points and perform matching; Based on the matched feature point pairs, a spatial transformation matrix is calculated by RANSAC algorithm; The spatial transformation matrix is used to resample and transform one of the images to realize alignment with the other image.
3. The method according to claim 1 or 2, characterized in that, After preliminarily locating the candidate difference region in step S2, further comprising: A deep learning semantic segmentation network is used to perform fine processing on the difference result, and the semantic segmentation network is a U-Net or DeepLab model, which is used to output a high-precision difference region binary mask to improve the positioning accuracy of the difference boundary.
4. The method of claim 1, wherein, In step S3, the multi-dimensional feature extraction specifically comprises: Hu moment, area and perimeter describing the geometric shape of the region are extracted as shape features; Local binary pattern (LBP) or histogram of oriented gradients (HOG) features are extracted as texture features; The absolute position of the difference region and the type information of its adjacent elements are extracted as context features.
5. The method of claim 1, wherein, The pre-trained classification model in step S4 is one of support vector machine (SVM), random forest, convolutional neural network (CNN) or Vision Transformer.
6. The method of claim 1, wherein, The type classification result in step S4 includes at least one of size change, graphic addition or deletion, text modification and annotation change.
7. An image recognition and classification based automatic comparison system for engineering drawings difference, for implementing the method according to any one of claims 1 to 6, characterized in that, It comprises: An image input module for receiving different versions of engineering drawing images; A pre-processing and registration module for performing image grayscale, filtering, binarization and feature point-based image registration operation; A difference detection module for performing pixel difference, morphological processing and semantic segmentation to locate the difference region; A feature extraction and classification module for extracting multi-dimensional features from the difference region and using a pre-trained classification model to distinguish the difference type; An output module for generating a structured difference report and / or visual comparison result.
8. The system of claim 7, wherein, The difference detection module is further configured to: First, generate a candidate difference region through pixel difference and morphological operation; Then, call a pre-trained semantic segmentation model to perform fine boundary segmentation on the candidate region.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the steps of the method of any one of claims 1 to 6 when executing the program.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the steps of the method according to any one of claims 1 to 6.