A method and system for identifying industrial drawing table structure
By performing gamma correction and rectangular mark area detection on RGB images of industrial drawings, combined with adjacency matrix coding, the problem of special symbols and multi-scale text recognition in industrial drawings is solved, and high-accuracy and low-complexity drawing structuring is achieved. Identify.
Patent Information
- Application Number
- CN202110953113.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-19
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-08-19
AI Technical Summary
The existing technology cannot effectively identify special symbols and multi-scale texts during the recognition process of industrial drawings, and the calculation complexity is high and it is difficult to adapt to font differences and symbol changes, resulting in low recognition accuracy.
By obtaining RGB images of industrial drawings, perform gamma correction and definition optimization, use rectangular marking areas for symbol and non-symbol detection classification, extract features and use adjacency matrix encoding for two-dimensional sorting to form editable drawing table documents.
It achieves structured recognition of industrial drawings, improves the recognition accuracy of text and symbols, is suitable for drawing processing in a variety of scenarios, and reduces computational complexity and hardware computing requirements.
Smart Images

Figure CN113610043B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition and processing, and in particular to the recognition, processing and conversion of industrial drawings. Background Art
[0002] Tables in industrial drawings generally contain words, letters and various symbols, and words, letters and symbols have various combinations. Generally speaking, we call the contents of words, letters and their combination as normal areas, and the contents containing symbols and upper and lower marks as abnormal areas. When converting paper industrial drawing tables into computer-editable tables, we can use general text recognition technology and high-precision text recognition technology.
[0003] Among them, the general text recognition technology is a general scene detection algorithm that realizes general image recognition by identifying, detecting and analyzing the text in the picture and then performing file parsing through serialized decoding prediction. This method cannot recognize special symbols and has high requirements for line alignment. Its deep learning algorithm based on segmentation and detection was used in the general text recognition algorithm and found that asymmetric table text positioning cannot be achieved when performing structured analysis of industrial drawing tables. At the same time, researchers found that when parsing normal area recognition, it is particularly sensitive to the resolution of the layout. The above algorithm has overfitting in the downsampling process according to the receptive field of different types of regional information, resulting in high calculation density, but the text extraction effect of grid-type non-complex background tables is poor and this pyramid design requires high hardware computing power.
[0004] High-precision text recognition technology uses the target detection and semantic segmentation model in deep learning to first complete the segmentation of the text area. This method predicts the category of the scene image data and marks the area for detection and recognition, and then obtains the results for storage and evidence collection. This process is optimized and learned online through reinforcement learning methods, thereby achieving the flexibility of high-precision text detection and recognition. However, there are two problems with this method: the first is the high computational complexity, and it is difficult to modify the model in a short time if there is a problem. The second is that the algorithm solves multi-angle recognition but not multi-scale recognition. With the development of neural network technologies such as DBNet and EAST, digital recognition of multi-modal general scenes has achieved significant results. High-precision text recognition technology has surpassed the accuracy of all traditional algorithms in general text detection and recognition, and can achieve multiple angles and free scenes. However, the particularity of these deep learning algorithms is that a series of downsampling is designed in the model to extract feature map information. This method is suitable for industrial drawings with variable backgrounds and single foregrounds, with regular text but large scale changes. Since the model input is set to a fixed input, the sensitivity to the feature map of the read image leads to a much lower recognition accuracy if there is font difference. This poses a great challenge to the recognition of tolerances and related symbols of industrial drawings. Summary of the invention
[0005] In view of this, the present invention provides a method for structural recognition of industrial drawing tables, the key of which is to perform the following steps:
[0006] Step 1: Obtain the original image data of the industrial drawing to form a unified RGB image;
[0007] Step 2: performing gamma correction on the RGB image to adjust the contrast of the RGB image and optimize the clarity of the RGB image;
[0008] Step 3: Use a marking tool to select the content of the optimized RGB image to obtain a number of rectangular marked areas, and perform symbol and non-symbol detection and classification according to the content contained in each rectangular marked area;
[0009] Step 4: extract features from each rectangular marking area, obtain the chart content therein, and obtain corresponding text or symbols;
[0010] Step 5. In the same coordinate system, according to the coordinate position of each rectangular marking area, the text or symbols associated with it are sorted in two dimensions using adjacency matrix encoding according to the coordinate position. The sorted chart content is recorded in a specific table through a memory mapping table associated with the dictionary to obtain an editable drawing table document.
[0011] In addition, the present invention also provides a system for industrial drawing table structure recognition method, the main points of which are: comprising a drawing data analysis module, an algorithm analysis module and a data structuring module arranged in sequence;
[0012] The drawing data analysis module is used to obtain the original image data of the industrial drawing, form a unified RGB image, and perform gamma correction on the RGB image;
[0013] The algorithm analysis module is used to select the content of the RGB image to obtain a number of rectangular marked areas, and perform symbol and non-symbol detection classification according to the content contained in each rectangular marked area; and perform feature extraction on each rectangular marked area to obtain the chart content therein and obtain the corresponding text or symbol;
[0014] The data structuring module is used to obtain the coordinate position of each rectangular marking area, and to perform two-dimensional sorting of the text or symbols associated therewith according to the coordinate position by using adjacency matrix encoding. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is the principle diagram of the present invention;
[0016] Figure 2 This is a flow chart of Example 3. DETAILED DESCRIPTION
[0017] The present invention is further described below in conjunction with embodiments and drawings.
[0018] Embodiment 1:
[0019] A method for structural recognition of industrial drawing tables is carried out in the following steps:
[0020] Step 1: Use HTTP protocol to transmit a request to obtain the server or file directory storage address information, then select the PDF file of the industrial drawing to be read as the original image data, perform cyclic reading and encoding and decoding analysis on the PDF file, decode it into a data matrix of the image according to the raster information in the PDF file data, transcode the data matrix to obtain bitmap data, decode the PDF file into pictures by paging, and then encode and reconstruct it into a three-channel RGB image according to the logical order of picture generation, and finally convert it into JPG format;
[0021] Step 2: performing gamma correction on the RGB image to adjust the contrast of the RGB image and optimize the clarity of the RGB image;
[0022] Step 3: Use the labelimg annotation tool to select the content of the optimized RGB image to obtain a number of rectangular marked areas, and perform symbol and non-symbol detection and classification according to the content contained in each rectangular marked area;
[0023] Step 4: extract features from each rectangular marking area, obtain the chart content therein, and obtain corresponding text or symbols;
[0024] Step 5. In the same coordinate system, according to the coordinate position of each rectangular marking area, the text or symbols associated with it are sorted in two dimensions using adjacency matrix encoding according to the coordinate position. The sorted chart content is recorded in a specific table through a memory mapping table associated with the dictionary to obtain an editable drawing table document.
[0025] The coordinate position of the rectangular marking area is obtained in the following manner:
[0026] Obtaining the coordinate values of the upper left corner and the lower right corner of each rectangular marking area based on the same coordinate system, and performing cluster analysis to optimize the algorithm positioning process;
[0027] Initialize k samples, and use a as the initial cluster center, a=a1,a2,......a k , for each sample x i , using Euclidean distance, for each category a i Recalculate the mean of the cluster center of each category
[0028] In the above formula:
[0029] N is the sample size;
[0030] a j The coordinates of the mean center of each sample after the algorithm updates;
[0031] c i represents the value of the cluster center;
[0032] x i is the data point of the input point cluster.
[0033] Embodiment 2:
[0034] An industrial drawing table structured recognition system based on embodiment 1, comprising a drawing data analysis module, an algorithm analysis module and a data structuring module arranged in sequence;
[0035] The drawing data analysis module is used to obtain the original image data of the industrial drawing, form a unified RGB image, and perform gamma correction on the RGB image;
[0036] The algorithm analysis module is used to select the content of the RGB image to obtain a number of rectangular marked areas, and perform symbol and non-symbol detection classification according to the content contained in each rectangular marked area; and perform feature extraction on each rectangular marked area to obtain the chart content therein and obtain the corresponding text or symbol;
[0037] The data structuring module is used to obtain the coordinate position of each rectangular marking area, and to perform two-dimensional sorting of the text or symbols associated therewith according to the coordinate position by using adjacency matrix encoding.
[0038] Embodiment 3:
[0039] General scene text recognition example:
[0040] (1) Read a PDF file from the OSS database into a variable function through the HTTP protocol.
[0041] (2) Convert the PDF file into an array through raster and vector exchange and then transfer it to the image matrix.
[0042] (3) After encoding the image data, it is converted into a JPG image of RGB image through the image construction method.
[0043] (4) Interactively annotate industrial drawings containing special symbols and normal symbols respectively.
[0044] (5) Use VOCdevkit format data for standard training.
[0045] (6) Based on the TCR model, channel enhancement is performed on industrial chart data to achieve layering and filtering to reduce background interference.
[0046] (7) Apex mixed precision training and SymBM used in the TCR model simplify the difficulty of model training and improve the accuracy.
[0047] (8) To address the interference of multimodal drawings and images, the BezierAlign layer is used to implement ROIAlign on fine-grained areas to find small areas and mask them to take the predicted value of the maximum value of the circumscribed rectangle. The text area suggestion box obtained is directly recognized for normal cases through type analysis and recognition. For abnormal cases, fine-grained recognition is used to sort small targets and then sort them according to the logic of sorting. After recognition and output, the output results are determined after human-computer interactive evaluation.
[0048] (9) Use the half-precision APEX training method to train the model, and use the half-precision, slim, and purne methods to accelerate model recognition on multiple terminals.
[0049] (10) The trained model is linked and interacted with data and related service algorithms through RPC protocol communication.
[0050] (11) Input the image data to be tested, the label of the predicted result, and the name of the parameter of the returned result and store them in the log.
[0051] Embodiment 4:
[0052] The principles of the structured data algorithm model for drawing data include the following:
[0053] Layout analysis table extraction: Pulse-like horizontal projection diagram realizes table analysis and separation, and defines the following parameters:
[0054] I is an industrial drawing image, where the width and height are H*W, and J is the special character area (tolerance and symbol) in the image; if the image satisfies the following:
[0055] J(x,y)={(x,y)|x∈[w1,w2],y∈[h1,h2]≥nh}
[0056] n represents the nth row of the table, and h represents the height of each row of the table;
[0057] The number of pixels in the horizontal and vertical directions of the table is as follows:
[0058]
[0059] In the above formula:
[0060] d is the distance between corner points of tables;
[0061] R is the number of horizontal pixels of spacing in the table;
[0062] C is the number of vertical pixels of spacing in the table.
[0063] Based on the above, the pixel values and location information of the relevant coordinate points in the table can be extracted through connectivity calculation.
[0064] Through the above method, we can separate the foreground and background of the text in the table. If we encounter a large text table with multiple isolated rows, we use pixel coordinate conversion to obtain the target area. We first divide the grid and then classify it according to the coordinates of the center point of the grid division. Those grids are determined as a type and then a prediction value is comprehensively solved. After analyzing the error of the loss function, it is determined as a target when it is the smallest. The target area can be obtained through the above method. Each detected target is divided into fixed-height strips. This is to achieve the prediction of text signals and specially process the image matrix design. The content of the characters is predicted through labels and true predictions. In the case of large distances between characters, an empty placeholder needs to be inserted to ensure the stability of the sequence signal. When an output is given, the probability of the possible output value that needs to be calculated is as follows:
[0065]
[0066] In the above formula, P(π|x) represents the probability of a possible path with a given output x outputting the value π. It represents the probability that the output of step t in the output sequence within a period of time is k; the recognition result and probability of each character are output through the above overall idea method.
[0067] Industrial drawing binarization: For an image with a height and width of H*W, the output value probability is P. First, each pixel needs to be binarized to obtain the feature map after noise reduction. The relevant calculation is as follows:
[0068]
[0069] In the above formula, t represents the preset threshold, i and j represent the coordinate positions in the probability, and the output of 0 and 1 is used to test whether there is a text area in the area, thereby realizing the separation calculation between the background positive and negative samples.
[0070] First, we use the original standard box as G, and use the above offset D to expand it to get a box G d , calculate G d The distances from all points in G to the four edges of G are selected, and the smallest distance is chosen. dThe distance between the pixel in the box and the edge of the G box closest to it, the above problem is referred to as the distance from the pixel to the G box.
[0071] By finding G d The distance from all pixels in the box to G is normalized by removing the offset D, which can limit its distance to the range of [0,1]. Values greater than 1 are 1, and values less than 0 are 0. This is convenient to get G. d Box and G s (represents the predicted value) The pixels between the boxes get the normalized distance. The error scaling method in this process is calculated as follows:
[0072] L=L s +α×L b +β×L t
[0073] In the above formula, L s Represents the probability of loss, L b represents the loss of binary feature map, L t represents the loss of the threshold, α and β represent the hyper parameters of the calculation process, which are 0.1 and 10. Through the above method, we can find a word.
[0074] Recognition process: When we get a word, we pass it through convolution and get a feature map. Each row of the time period is input into a time series network. The length is m and the height is T. When the time is 1≤t≤T, the output decoding value is y. When the predicted value probability is positive, the predicted value and predicted character are output. If there is no answer or a negative number, it is replaced by a blank character.
[0075] During the model training process, b x ,b y ,b w ,b h They represent the upper left corner horizontal coordinate, vertical coordinate, width, and height of the real coordinate position of the mark of an input image. The predicted value is:
[0076] b x =σ(t x )+c x
[0077] b y =σ(t y )+c y
[0078] b w =p w e tw
[0079] b h =p h e th
[0080] In the above formula, the origin is the upper left corner zero point, b x ,b y is the horizontal and vertical coordinate point pair of the coordinate frame that needs to be predicted. x ,t y ,t w ,t h Represents four offsets respectively. x ,c y Indicates the offset from the center point of the current feature map prediction unit to the upper left corner of the image, σ(t x ),σ(t y ) is to use the logistic regression method to normalize the coordinates to a range interval for the variable, b w ,b h The width and height of the point with the largest overlap with the real frame are mainly predicted by the offset so that the coordinates that need to be clustered are as consistent as possible with the real annotations to achieve the detection of normal and abnormal text areas. How to distinguish their specific categories is calculated as follows:
[0081]
[0082] In the above formula represents the probability of the presence of a marked content feature map in each grid, p r (object) is the probability of whether there is a predicted object in the current box, The weight value of the intersection of the area of the predicted box of the feature map and the real box at the coordinate position. The above method can realize the drawing data analysis part and the algorithm data analysis part. Next, we use the graph network to realize the serialized output according to the regional relationship. First, we locate the position and type identified by the algorithm part according to the content through the graph network model. The main core of the graph network model is the adjacency matrix to realize content sorting.
[0083] Let G be an undirected graph, and we can get the adjacency matrix A of G G =(A ij ).when:
[0084]
[0085] The connection judgment condition is
[0086] A ij Represents vertex ij, and at the same time, the relationship threshold of the edge connection between them can be found.
[0087] After the above calculations to realize the first half of the data structure, the sorted notes are then sent to the recognition model in sequence through the queue to output the results, and then the above method is used to achieve serialized output. The recognition part of the process is calculated as follows:
[0088]
[0089] In the above formula, we will input n pictures for recognition and convert the input pictures into feature map tensors such as n(1,T,D), where T and D are the maximum time span of the time series (indicating the number of time inputs T=W / 4, W is the image width) and the column vector respectively. When in a time series segment, the time span is used to determine whether to add spaces to control the output of the row.
[0090] Beneficial effects: The technical solution of the present invention realizes the data structuring and onlineization of engineering drawings in the process of product development of enterprises; realizes digital management and transformation; realizes parameter configuration, result proofreading and production control of automated production; is applicable to drawing text recognition and symbol recognition in various scenarios, real-time structured output of operating systems in various scenarios, rapid preparation of inspection documents and result entry, and automatic entry of process parameters and production tools.
[0091] Finally, it should be noted that the above description is only a preferred embodiment of the present invention. Under the guidance of the present invention, ordinary technicians in this field can make various similar expressions without violating the purpose and claims of the present invention, and such changes all fall within the scope of protection of the present invention.
Claims
1. A method for structural recognition of industrial drawing tables, characterized in that Follow these steps: Step 1: Obtain the original image data of the industrial drawing to form a unified RGB image; Step 2: performing gamma correction on the RGB image to adjust the contrast of the RGB image and optimize the clarity of the RGB image; Step 3: Use a marking tool to select the content of the optimized RGB image to obtain a number of rectangular marked areas, and perform symbol and non-symbol detection and classification according to the content contained in each rectangular marked area; (1) Read a PDF file from the OSS database into a variable function through the HTTP protocol; (2) Convert the PDF file into an array through raster and vector exchange and then transfer it to the image matrix; (3) After encoding the image data, convert it into a JPG image of RGB image through the image construction method; (4) Interactively annotate industrial drawings containing special symbols and normal symbols respectively; (5) Use VOCdevkit format data for standard training; (6) Based on the TCR model, channel enhancement is performed on industrial chart data to achieve layering and filtering to reduce background interference; (7) Apex mixed precision training and SymBM used in the TCR model simplify the difficulty of model training and improve accuracy; (8) To address the interference of multimodal drawings and images, the BezierAlign layer is used to implement ROIAlign on fine-grained areas to find small areas and mask them to take the predicted value of the maximum value of the circumscribed rectangle; the text area suggestion box is directly recognized for normal cases through type analysis and recognition, and fine-grained recognition is used to sort small targets for abnormal cases, and then the adjacent sorting is performed according to the sorting logic to identify and output the results. The output results are determined after human-computer interactive evaluation; (9) Use the half-precision apex training method to train the model, and use the half-precision, slim and purne methods to accelerate model recognition on multiple terminals; (10) Link and interact the trained model with data and related service algorithms through RPC protocol communication; (11) Input the image data to be tested, the label of the predicted result, and the name of the parameter of the returned result, and return them to the log; Step 4: Extract features from each of the rectangular marked areas, obtain the chart content therein, and obtain the corresponding text or symbol; Step 5: In the same coordinate system, according to the coordinate position of each rectangular mark area, the text or symbol associated with it is sorted in two dimensions by using the adjacency matrix encoding method according to the coordinate position, and the sorted chart content is recorded in a specific table through the memory mapping table associated with the dictionary to obtain an editable drawing table document; Obtaining the coordinate values of the upper left corner and the lower right corner of each rectangular marking area based on the same coordinate system, and performing cluster analysis to optimize the algorithm positioning process; Initialize k samples, and use a as the initial cluster center, a=a1,a2,......a k , for each sample x i , using Euclidean distance, recalculate the cluster center mean of each category for each category of ai In the above formula N is the sample size; a j The coordinates of the mean center of each sample after the algorithm updates; c i represents the value of the cluster center; x i is the data point of the input point cluster.
2. The method for recognizing structured tables in industrial drawings according to claim 1, characterized in that: In the step 1, a PDF file of an industrial drawing is obtained as the original image data, the PDF file is cyclically read and subjected to encoding and decoding analysis, the PDF file is page-by-page decoded into images, and then encoded and transmitted according to the logical order in which the images are generated to form a unified RGB image.
3. The method for recognizing structured tables in industrial drawings according to claim 2, characterized in that: In the step 1, the HTTP protocol is used to transmit a request to obtain the server or file directory storage address information, and then the PDF file of the industrial drawing that needs to be read is selected.
4. The method for recognizing structured tables in industrial drawings according to claim 2, characterized in that: In the step 1, the raster information in the PDF file data is decoded into a data matrix of the image, and then the data matrix is transcoded to obtain bitmap data, which is then re-encoded and reconstructed into a three-channel RGB image, and finally converted into a JPG format.
5. A system based on the industrial drawing table structured recognition method according to claim 1, characterized in that: It includes a drawing data analysis module, an algorithm analysis module and a data structuring module which are arranged in sequence; The drawing data analysis module is used to obtain the original image data of the industrial drawing, form a unified RGB image, and perform gamma correction on the RGB image; The algorithm analysis module is used to select the content of the RGB image to obtain a number of rectangular marked areas, and perform symbol and non-symbol detection classification according to the content contained in each rectangular marked area; and perform feature extraction on each rectangular marked area to obtain the chart content therein and obtain the corresponding text or symbol; The data structuring module is used to obtain the coordinate position of each rectangular marking area, and to perform two-dimensional sorting of the text or symbols associated therewith according to the coordinate position by using adjacency matrix encoding.
Citation Information
Patent Citations
Engineering drawing material information extraction method based on template
CN101882225A
Convolutional neural network-based character recognition method
CN108596066A
Ship intelligent identification tracking method
CN110147807A
Table recognition method and device, computer device and storage medium
CN110334585A
Road traffic sign automatic identification and classification method
CN111488854A
