Engineering drawing analysis and identification method and system based on AI
Through AI-based methods, view and label detection and classification of two-dimensional engineering drawings, combined with OpenCV and Tesseract-OCR for text correction, the complexity and labeling problems of two-dimensional drawing recognition are solved, and efficient and accurate automated recognition and management are achieved, which is suitable for multi-industry drawing standards.
Patent Information
- Application Number
- CN202510568775.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-12
AI Technical Summary
The existing two-dimensional engineering drawing recognition technology is complex and difficult to label, which leads to inconsistent interpretation, time-consuming and error-prone, especially in the absence of standardization of drawing formats and symbols.
Using AI-based methods, OpenCV is used for image preprocessing, combined with YOLOv7 model for detection and classification of views and labeling groups, and using Tesseract-OCR for text angle correction and recognition, and finally providing web interface management recognition results through Flask.
It significantly simplifies the identification process, improves the identification accuracy, reduces manual intervention and identification time, is suitable for multiple views and complex annotations, supports automated production system integration, and reduces production costs.
Smart Images

Figure CN120472491A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer information technology, and in particular to an AI-based engineering drawing analysis and recognition method and system. Background Art
[0002] Two-dimensional engineering drawings are a crucial tool for conveying design information in the manufacturing industry. Despite the continuous advancement of CAD software and 3D model annotation technology, 2D drawings remain widely used due to their high performance and information accessibility. 2D drawings convey design intent through annotations (such as dimensions, tolerances, and geometric symbols), and employ techniques such as rotation, scaling, and sectioning to enable readers to quickly understand the design. However, with increasing precision requirements and intensified market competition in the manufacturing industry, the demand for design drawings continues to grow, and their interpretation has become a critical step in the design phase.
[0003] Traditionally, skilled technicians manually interpret these drawings for machining and quality control. However, this approach is time-consuming and error-prone, especially when drawing formats and symbols are not standardized. Engineers from different departments may interpret the same drawing differently, resulting in inconsistent measurements, reduced product quality, and increased costs. Geometric dimensioning and tolerancing (GD&T) standards, such as ASME Y14.5 2018, serve as a common language designed to standardize engineering drawings and improve clarity and consistency.
[0004] In recent years, deep learning technology has made significant progress in the automatic recognition of 2D engineering drawings, but many challenges remain. The complexity of engineering drawings, including large numbers of similar shapes, overlapping elements, text in multiple fonts and orientations, as well as document quality issues, unbalanced datasets, and topological problems, make the recognition task difficult. Summary of the Invention
[0005] In view of the above technical problems, the present invention provides an AI-based engineering drawing analysis and recognition method and system to solve the problems of high complexity and difficulty in marking in existing drawing recognition technology.
[0006] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.
[0007] According to one aspect of the present invention, an AI-based engineering drawing analysis and recognition method is proposed, the method comprising:
[0008] Preprocessing the input 2D engineering drawing includes grayscale conversion, image inversion and binarization using OpenCV;
[0009] Using a YOLOv7 model to detect and classify views in the engineering drawing, the views including top view, front view, right view, and isometric view;
[0010] Use another YOLOv7 model to detect annotation groups in each view and classify them into dimension annotations with dimensions and tolerances, datum annotations for datum planes, and feature control frame annotations. Dimensions represent the basic dimensions of a part, tolerances represent the allowed differences in part dimensions, and feature control frames describe the conditions and tolerances for geometric control.
[0011] Using a third YOLOv7 model, identifying specific annotations in the annotation group, wherein dimension annotations are obtained by adding or subtracting tolerance symbols from basic dimension annotations, or by upper and lower tolerance limits, feature control frame annotations are obtained by geometric feature symbols, specified tolerances, and datums, and datum annotations of datum planes are obtained by the symbols of the datum planes;
[0012] Perform angle correction on the text in the recognized annotations, combining OpenCV's angle detection with Tesseract-OCR's orientation detection. Use Tesseract-OCR to recognize the text and symbols in the corrected annotations and extract numerical values and engineering symbols.
[0013] The extracted numerical values and engineering symbols are stored in the database, and a Flask-based web interface is provided for users to view, edit and manage the recognition results.
[0014] Furthermore, the preprocessing specifically includes:
[0015] Use OpenCV's cv2.cvtColor function to convert the input image to a grayscale image;
[0016] Use cv2.bitwise_not function to invert the grayscale image;
[0017] Apply Gaussian blur using the cv2.GaussianBlur function with a kernel size of (7,7).
[0018] Use the cv2.threshold function to perform binarization using the Otsu threshold method to generate a binary image with foreground pixel values of 255 and background pixels of 0.
[0019] Furthermore, when performing text angle correction, it specifically includes:
[0020] Use OpenCV's cv2.minAreaRect function to detect the minimum bounding rectangle of the text area and calculate the rotation angle;
[0021] If the rotation angle is greater than 45 degrees, subtract 90 degrees for adjustment;
[0022] Apply the rotation transformation using cv2.getRotationMatrix2D and cv2.warpAffine functions, using cubic interpolation and cv2.BORDER_REPLICATE as the boundary mode;
[0023] Use the image_to_osd function of Tesseract-OCR to detect the text orientation. If it is a multiple of 90 degrees, use the np.rot90 function to perform rotation correction.
[0024] Furthermore, when recognizing numerical values and engineering symbols based on Tesseract-OC, including identifying symbols used in geometric dimensions and tolerances, basic dimensions, tolerance values, geometric feature symbols, specified tolerances and datum references are extracted from the corrected text image.
[0025] According to another aspect of the present invention, there is provided an AI-based engineering drawing analysis and recognition system, comprising:
[0026] A preprocessing module preprocesses the input 2D engineering drawing, including grayscale conversion, image inversion and binarization using OpenCV;
[0027] A classification module uses a YOLOv7 model to detect and classify views in the engineering drawing, including top views, front views, right views, and isometric views; another YOLOv7 model is used to detect annotation groups in each view and classify them into dimension annotations with dimensions and tolerances, datum annotations for datum planes, and feature control frame annotations, where the dimensions represent the basic dimensions of the part, the tolerances represent the allowable differences in the part dimensions, and the feature control frames describe the conditions and tolerances of geometric control; a third YOLOv7 model is used to identify specific annotations in the annotation groups, where the dimension annotations are obtained in the form of basic dimension annotations plus or minus tolerance symbols, or in the form of upper and lower limits of tolerance annotations, the feature control frame annotations are obtained by geometric feature symbols, specified tolerances, and datums, and the datum annotations of datum planes are obtained by the symbols of the datum planes;
[0028] The information recognition module is used to perform angle correction on the text in the identified specific annotations, combining OpenCV's angle detection and Tesseract-OCR's orientation detection during correction. Tesseract-OCR is used to recognize the text and symbols in the corrected annotations and extract numerical values and engineering symbols.
[0029] The information display module is used to store the extracted numerical values and engineering symbols in the database and provide a Flask-based web interface for users to view, edit and manage the recognition results.
[0030] Furthermore, when the system is built, it includes:
[0031] Develop a web application using Flask to display pre-trained and post-trained recognition information;
[0032] Use Python to integrate OpenCV for image pre-processing and post-processing, YOLOv7 for target detection, and Tesseract-OCR for text recognition;
[0033] Use Microsoft SQL Server to store training data and recognition results.
[0034] The technical solution of the present invention has the following beneficial effects:
[0035] By employing the YOLOv7 model for hierarchical feature recognition, the engineering drawing recognition process is broken down into three layers: view detection, annotation group detection, and specific annotation recognition, significantly simplifying the recognition process. Compared to traditional manual interpretation or single-model recognition, this method automatically detects and classifies views and annotations, significantly reducing manual intervention and recognition time.
[0036] This paper integrates OpenCV and Tesseract-OCR to perform text angle correction and recognition, automatically processing text with non-standard orientations, and overcoming the limitations of traditional OCR tools when processing multi-directional text. It can complete text correction and recognition without manual intervention, greatly reducing the difficulty of annotation. Furthermore, the system supports automatic storage of recognition results in a database, further reducing the workload of manual annotation.
[0037] Through multi-layer YOLOv7 model training, this invention significantly improves recognition accuracy. Test results show that the accuracy of view detection reaches 85%, the accuracy of annotation detection reaches 70%, and the accuracy of text and symbol recognition reaches 80%. Compared with existing technologies, the accuracy is improved by 10% to 20%, effectively reducing misidentification and missed recognition.
[0038] The system can handle engineering drawings containing multiple views and complex annotations, and is applicable to the drafting standards of different industries. The system can accurately extract geometric feature symbols, tolerances, and datum information, enhancing its adaptability in complex drafting environments.
[0039] The present invention stores the recognition results directly in the database, supports seamless integration with the automated production system, reduces errors in manual data entry, and provides accurate data support for subsequent processing and inspection, thereby shortening the product development cycle and reducing production costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1This is a flowchart of an AI-based engineering drawing analysis and recognition method in an embodiment of this specification;
[0041] Figure 2 This is a structural block diagram of an AI-based engineering drawing analysis and recognition system in an embodiment of this specification. DETAILED DESCRIPTION
[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present invention will be more comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or that other methods, components, devices, steps, etc. may be employed. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.
[0043] The accompanying drawings are merely schematic illustrations of the present invention. Identical reference numerals in the drawings denote identical or similar components, and thus repetitive descriptions thereof will be omitted. Some of the blocks shown in the accompanying drawings represent functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0044] The present invention provides a product AI-based engineering drawing analysis and recognition method. Figure 1 The figure shows a flow chart of an AI-based engineering drawing analysis and recognition method for a product provided by an embodiment of the present invention. The method can be applied to electronic devices such as personal computers and servers. The method can be performed by a device, which can be implemented by software and / or hardware. The method can specifically include the following steps S101 to S105:
[0045] In step S101 , the input 2D engineering drawing is preprocessed, and the preprocessing includes grayscale conversion, image inversion and binarization using OpenCV.
[0046] As a supplement, the preprocessing specifically includes: using OpenCV's cv2.cvtColor function to convert the input image into a grayscale image; using the cv2.bitwise_not function to invert the grayscale image; using the cv2.GaussianBlur function to apply Gaussian blur with a convolution kernel size of (7,7); using the cv2.threshold function to binarize using the Otsu threshold method to generate a binary image with a foreground pixel value of 255 and a background pixel value of 0.
[0047] OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library that provides a wide range of image processing, computer vision, and machine learning algorithms, as well as tools and functions for implementing these algorithms. In this step, the input color image is converted to a grayscale image using the OpenCV cv2.cvtColor function. Grayscale conversion removes color information while retaining brightness information, reducing the complexity of image data, thereby reducing the computational complexity of subsequent processing and improving feature extraction efficiency. The grayscale image is inverted using the cv2.bitwise_not function. Image inversion reverses pixel values (i.e., subtracting the original pixel value from 255), brightening darker areas and darkening lighter areas. This enhances the contrast of lines and symbols in engineering drawings, facilitating subsequent detection. The inverted image is Gaussian blurred using the cv2.GaussianBlur function, setting the convolution kernel size to (7,7). Gaussian blurring smoothes the image, reducing the effects of noise and fine details, and providing a more stable image foundation for subsequent binarization and object detection. Use the cv2.threshold function to binarize the blurred image using the Otsu thresholding method, generating a binary image with foreground pixel values of 255 (white) and background pixels of 0 (black). Binarization simplifies the image into black and white, highlighting key features of engineering drawings and providing clear input data for deep learning models.
[0048] In step S102, a YOLOv7 model is used to detect and classify views in the engineering drawing, which include top views, front views, right views, and isometric views; another YOLOv7 model is used to detect annotation groups in each view and classify them into dimension annotations with dimensions and tolerances, datum annotations for datum planes, and feature control frame annotations, where the dimensions represent the basic dimensions of the parts, the tolerances represent the allowable differences in the dimensions of the parts, and the feature control frames describe the conditions and tolerances of the geometric controls; a third YOLOv7 model is used to identify specific annotations in the annotation groups, where the dimension annotations are obtained in the form of basic dimension annotations plus or minus tolerance symbols, or in the form of upper and lower limits of tolerance annotations, the feature control frame annotations are obtained by geometric feature symbols, specified tolerances, and datums, and the datum annotations of the datum planes are obtained by the symbols of the datum planes.
[0049] This step uses multiple YOLOv7 models to perform hierarchical detection and classification on pre-processed 2D engineering drawings to automatically extract key information. This process is divided into three main stages: view detection and classification, annotation group detection and classification, and specific annotation recognition.
[0050] The first YOLOv7 model has mastered the visual features of different views through supervised learning on a large number of annotated engineering drawing data sets, and can accurately detect and classify view areas in the drawing. In the second model, the content of the dimension annotation contains the basic size and tolerance information of the part. Its definition is that the basic size represents the theoretical design size of the part, and the tolerance represents the allowable deviation range of the part size. For example, "50±0.05" means that the basic size is 50 mm and the tolerance is ±0.05 mm. The content of the datum annotation is the annotation used to indicate the datum plane. Its definition is: the datum plane is the reference plane for part processing or measurement. For example: "datum A" indicates that a specific plane is used as a datum. The content of the feature control frame describes the conditions and tolerances of geometric control. Its definition is used to specify the control requirements for the geometric shape, position or orientation of the part. Example: such as The diameter tolerance is 0.03 mm, and datums A and B are associated. The second YOLOv7 model learns the visual features of annotations in the view (such as text boxes, arrows, and symbols) to accurately detect the location and classify annotation groups. The third YOLOv7 model is trained on the detailed features of annotation groups (such as numbers, symbols, and text formatting) to accurately extract the specific content of the annotations.
[0051] In step S103, the text in the identified specific annotation is angle-corrected by combining OpenCV's angle detection and Tesseract-OCR's orientation detection. Tesseract-OCR is used to recognize the text and symbols in the corrected annotation, and extract numerical values and engineering symbols.
[0052] As a supplement, when performing text angle correction, it specifically includes: using OpenCV's cv2.minAreaRect function to detect the minimum enclosing rectangle of the text area and calculate the rotation angle; if the rotation angle is greater than 45 degrees, subtract 90 degrees for adjustment; using cv2.getRotationMatrix2D and cv2.warpAffine functions to apply rotation transformation, using cubic interpolation, and the boundary mode is cv2.BORDER_REPLICATE; using Tesseract-OCR's image_to_osd function to detect the text orientation, and if it is a multiple of 90 degrees, use the np.rot90 function to perform rotation correction.
[0053] Furthermore, when recognizing numerical values and engineering symbols based on Tesseract-OC, including recognizing symbols used in geometric dimensioning and tolerancing, basic dimensions, tolerance values, geometric feature symbols, specified tolerances, and datum references are extracted from the rectified text image.
[0054] Among them, in this step, for the text content in the specific annotations identified in engineering drawings, the present invention realizes text angle correction and content recognition by combining OpenCV and Tesseract-OCR technology to ensure accurate extraction of numerical values and engineering symbols. This process first solves the non-standard direction problem that may occur in the text in engineering drawings, such as rotated text caused by annotation angle or radius annotation. The correction process is implemented through two-stage detection and adjustment: first, the image processing capability of OpenCV is used to detect the angle of the text area, and then the orientation detection function of Tesseract-OCR is combined for further correction. After the correction is completed, Tesseract-OCR is used to identify text and symbols and extract key information. The combined application of this method effectively overcomes the limitations of traditional OCR tools in processing complex directional text.
[0055] Specifically, the text angle correction process involves a series of detailed steps. OpenCV's cv2.minAreaRect function is used to analyze the text area, generate the minimum enclosing rectangle, and calculate its rotation angle. This angle reflects the degree of inclination of the text relative to the horizontal direction. If the detected angle is greater than 45 degrees, it is adjusted by subtracting 90 degrees to ensure the correct direction of the subsequent rotation correction. Next, the rotation matrix is generated using the cv2.getRotationMatrix2D function, and the rotation transformation is applied using the cv2.warpAffine function to correct the text area to the standard orientation. During this process, cubic interpolation (cv2.INTER_CUBIC) is used to ensure image quality, and the boundary mode is set to cv2.BORDER_REPLICATE to copy boundary pixels to fill blank areas that may appear after rotation. In addition, Tesseract-OCR's image_to_osd function is used to detect the orientation of the text. If the text orientation is found to be a multiple of 90 degrees (such as 90 degrees, 180 degrees, or 270 degrees), further rotation correction is performed using NumPy's np.rot90 function. This dual correction mechanism ensures the accuracy of text direction and provides a reliable basis for subsequent recognition.
[0056] After completing the text angle correction, Tesseract-OCR is used to recognize the content in the corrected text image, focusing on extracting numerical values and engineering symbols, especially those related to geometric dimensioning and tolerance (GD&T). These symbols include basic dimensions (such as "50" mm), tolerance values (such as "±0.05"), geometric feature symbols (such as "0.05" for diameter), and so on. Or indicating location ), specified tolerances (such as "0.03"), and datum references (such as "A" or "B"). Through the character recognition capabilities of Tesseract-OCR, the system can accurately parse this information from the corrected text image and store the extracted results in a structured manner for subsequent analysis and application. This recognition process is not only applicable to standardized GD&T annotations, but can also handle complex symbol combinations commonly found in engineering drawings, thereby improving the practicality and robustness of the system.
[0057] In step S104 , the extracted numerical values and engineering symbols are stored in a database, and a Flask-based web interface is provided for users to view, edit, and manage the recognition results.
[0058] The present invention stores the numerical values and engineering symbols extracted through the aforementioned steps in a database and provides users with interactive functions through a Flask-based web interface to view, edit, and manage the recognition results. This process aims to efficiently store automatically recognized structured data and support subsequent operations through a user-friendly interface, thereby improving the practicality and flexibility of the engineering drawing recognition system.
[0059] Specifically, the extracted values and engineering symbols (such as basic dimensions, tolerance values, geometric feature symbols, specified tolerances, and datum references) are systematically organized and stored in a Microsoft SQL Server relational database. This database choice efficiently manages large amounts of data, supports fast query and update operations, and ensures reliable storage and traceability of recognition results. The stored data includes not only the original recognition results but also information associated with views and annotation groups, facilitating subsequent analysis and verification.
[0060] At the same time, the present invention uses the Flask network framework to develop a web interface to provide users with an intuitive interactive experience. Through this interface, users can view the identified views, annotation groups and their specific contents, such as "50±0.05" in the dimension annotation or " The MAB interface supports editing functions, allowing users to correct or supplement recognition results, such as modifying incorrect tolerance values or adding missing fiducial symbols. It also provides management functions such as deleting invalid data or exporting recognition results. This interactive design significantly enhances the system's flexibility, enabling users to perform manual verification and optimization based on automated recognition, thereby ensuring data accuracy and applicability.
[0061] Based on the same idea, as shown in Figure A, an AI-based engineering drawing analysis and recognition system is provided, including:
[0062] The preprocessing module 201 preprocesses the input 2D engineering drawing, and the preprocessing includes grayscale conversion, image inversion and binarization using OpenCV; the classification module 202 uses the YOLOv7 model to detect and classify the views in the engineering drawing, including top view, front view, right view and isometric view; another YOLOv7 model is used to detect the annotation group in each view and classify it into dimension annotation with size and tolerance, reference annotation for reference plane, and feature control frame annotation, where the size represents the basic size of the part, the tolerance represents the allowable difference in the part size, and the feature control frame describes the conditions and tolerances of the geometric control; a third YOLOv7 model is used to identify the specific annotations in the annotation group, where the size is the basic size of the part, the tolerance is the allowable difference in the part size, and the feature control frame describes the conditions and tolerances of the geometric control; The inch annotation is obtained in the form of basic dimension annotation plus or minus tolerance symbols, or in the form of upper and lower limits of tolerance annotation. The feature control frame annotation is obtained by geometric feature symbols, specified tolerances and datums, and the datum annotation of the datum plane is obtained by the symbol of the datum plane; the information recognition module 203 is used to perform angle correction on the text in the identified specific annotation, combining OpenCV's angle detection and Tesseract-OCR's orientation detection during the correction; Tesseract-OCR is used to recognize the text and symbols in the corrected annotation and extract numerical values and engineering symbols; the information display module 204 is used to store the extracted numerical values and engineering symbols in a database and provide a Flask-based web interface for users to view, edit and manage the recognition results.
[0063] When the system is built, it includes:
[0064] Develop a web application using Flask to display pre-trained and post-trained recognition information;
[0065] Use Python to integrate OpenCV for image pre-processing and post-processing, YOLOv7 for target detection, and Tesseract-OCR for text recognition;
[0066] Use Microsoft SQL Server to store training data and recognition results.
[0067] From the above system, it can be seen that this embodiment has the following beneficial effects:
[0068] By employing the YOLOv7 model for hierarchical feature recognition, the engineering drawing recognition process is broken down into three layers: view detection, annotation group detection, and specific annotation recognition, significantly simplifying the recognition process. Compared to traditional manual interpretation or single-model recognition, this method automatically detects and classifies views and annotations, significantly reducing manual intervention and recognition time.
[0069] This paper integrates OpenCV and Tesseract-OCR to perform text angle correction and recognition, automatically processing text with non-standard orientations, and overcoming the limitations of traditional OCR tools when processing multi-directional text. It can complete text correction and recognition without manual intervention, greatly reducing the difficulty of annotation. Furthermore, the system supports automatic storage of recognition results in a database, further reducing the workload of manual annotation.
[0070] Through multi-layer YOLOv7 model training, this invention significantly improves recognition accuracy. Test results show that the accuracy of view detection reaches 85%, the accuracy of annotation detection reaches 70%, and the accuracy of text and symbol recognition reaches 80%. Compared with existing technologies, the accuracy is improved by 10% to 20%, effectively reducing misidentification and missed recognition.
[0071] The system can handle engineering drawings containing multiple views and complex annotations, and is applicable to the drafting standards of different industries. The system can accurately extract geometric feature symbols, tolerances, and datum information, enhancing its adaptability in complex drafting environments.
[0072] The present invention stores the recognition results directly in the database, supports seamless integration with the automated production system, reduces errors in manual data entry, and provides accurate data support for subsequent processing and inspection, thereby shortening the product development cycle and reducing production costs.
[0073] The specific details of each module in the above system have been described in detail in the implementation method part. For details not disclosed, please refer to the implementation method part, and they will not be repeated here.
[0074] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary embodiment of the present invention.
[0075] Furthermore, the figures above are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention and are not intended to be limiting. It is readily understood that the processes illustrated in the figures above do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0076] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an exemplary embodiment of the present invention, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0077] Those skilled in the art will readily identify other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The description and embodiments are to be considered as exemplary only, with the true scope and spirit of the invention being indicated by the claims.
[0078] It should be understood that the present invention is not limited to the exact construction described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. An AI-based engineering drawing analysis and recognition method, characterized in that: The method comprises: Preprocessing the input 2D engineering drawing includes grayscale conversion, image inversion and binarization using OpenCV; Using a YOLOv7 model to detect and classify views in the engineering drawing, the views including top view, front view, right view, and isometric view; Use another YOLOv7 model to detect annotation groups in each view and classify them into dimension annotations with dimensions and tolerances, datum annotations for datum planes, and feature control frame annotations. Dimensions represent the basic dimensions of a part, tolerances represent the allowed differences in part dimensions, and feature control frames describe the conditions and tolerances for geometric control. Using a third YOLOv7 model, identifying specific annotations in the annotation group, wherein dimension annotations are obtained by adding or subtracting tolerance symbols from basic dimension annotations, or by upper and lower tolerance limits, feature control frame annotations are obtained by geometric feature symbols, specified tolerances, and datums, and datum annotations of datum planes are obtained by the symbols of the datum planes; Perform angle correction on the text in the recognized annotations, combining OpenCV's angle detection with Tesseract-OCR's orientation detection. Use Tesseract-OCR to recognize the text and symbols in the corrected annotations and extract numerical values and engineering symbols. The extracted numerical values and engineering symbols are stored in the database, and a Flask-based web interface is provided for users to view, edit and manage the recognition results.
2. The AI-based engineering drawing analysis and recognition method according to claim 1 is characterized in that: The pretreatment specifically includes: Use OpenCV's cv2.cvtColor function to convert the input image to a grayscale image; Use cv2.bitwise_not function to invert the grayscale image; Apply Gaussian blur using the cv2.GaussianBlur function with a kernel size of (7,7). Use the cv2.threshold function to perform binarization using the Otsu threshold method to generate a binary image with foreground pixel values of 255 and background pixels of 0.
3. The AI-based engineering drawing analysis and recognition method according to claim 1, characterized in that: When performing text angle correction, it specifically includes: Use OpenCV's cv2.minAreaRect function to detect the minimum bounding rectangle of the text area and calculate the rotation angle; If the rotation angle is greater than 45 degrees, subtract 90 degrees for adjustment; Apply the rotation transformation using cv2.getRotationMatrix2D and cv2.warpAffine functions, using cubic interpolation and cv2.BORDER_REPLICATE as the boundary mode; Use the image_to_osd function of Tesseract-OCR to detect the text orientation. If it is a multiple of 90 degrees, use the np.rot90 function to perform rotation correction.
4. The AI-based engineering drawing analysis and recognition method according to claim 1, characterized in that: When recognizing numerical values and engineering symbols based on Tesseract-OC, including recognizing symbols used in geometric dimensioning and tolerance, extracting basic dimensions, tolerance values, geometric feature symbols, specified tolerances and datum references from the rectified text image.
5. An AI-based engineering drawing analysis and recognition system, characterized in that: include: A preprocessing module preprocesses the input 2D engineering drawing, including grayscale conversion, image inversion and binarization using OpenCV; a classification module, which uses a YOLOv7 model to detect and classify views in the engineering drawing, including top view, front view, right view, and isometric view; Another YOLOv7 model is used to detect annotation groups in each view and classify them into dimension annotations with dimensions and tolerances, datum annotations for datum planes, and feature control frame annotations, where the dimensions represent the basic dimensions of the part, the tolerances represent the allowable differences in the part dimensions, and the feature control frames describe the conditions and tolerances for geometric control. A third YOLOv7 model is used to identify specific annotations in the annotation groups, where the dimension annotations are obtained by adding or subtracting tolerance symbols from the basic dimension annotations, or by the upper and lower limits of the tolerance annotations. The feature control frame annotations are obtained by geometric feature symbols, specified tolerances, and datums, and the datum annotations of datum planes are obtained by the symbols of the datum planes. The information recognition module is used to perform angle correction on the text in the identified specific annotations, combining OpenCV's angle detection and Tesseract-OCR's orientation detection during correction. Tesseract-OCR is used to recognize the text and symbols in the corrected annotations and extract numerical values and engineering symbols. The information display module is used to store the extracted numerical values and engineering symbols in the database and provide a Flask-based web interface for users to view, edit and manage the recognition results.
6. The AI-based engineering drawing analysis and recognition system according to claim 5, characterized in that: When the system is built, it includes: Develop a web application using Flask to display pre-trained and post-trained recognition information; Use Python to integrate OpenCV for image pre-processing and post-processing, YOLOv7 for target detection, and Tesseract-OCR for text recognition; Use Microsoft SQL Server to store training data and recognition results.
Citation Information
Patent Citations
Text inclination angle detection method and system and storage medium
CN113569847A
Engineering drawing labeling system and method
CN114398507A
Engineering drawing data analysis processing method and system
CN118038480A
Engineering energy industry equipment document and drawing bit number automatic extraction system
CN119559654A
Cast-in-place box girder image cross-key parameter identification method based on target detection and key information extraction
CN119851303A
Cited By
Engineering drawing size semantic analysis method and system based on visual language knowledge fusion
CN121259866A