A PDF document layout detection method, device, equipment and medium
By converting PDF documents into pictures and using a key point-based object detection network, the problem of being unable to detect PDF documents in various formats and categories in the prior art is solved, and the detection and layout detection of scanned documents is realized, which improves the Detection accuracy and speed.
Patent Information
- Application Number
- CN202210344990.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2042-04-02
AI Technical Summary
The existing PDF document layout detection algorithm cannot effectively detect PDF documents in multiple formats, categories and languages, and is particularly difficult to process scanning PDF documents. The existing algorithm model is complex and has high computational complexity, which cannot meet the real-time detection requirements. .
By obtaining historical PDF documents of preset content, formats and languages, converting their pages into pictures, and using a key point-based object detection network for training, generating training models to detect PDF documents in multiple formats, categories and languages, and realizing Detection of scanned documents. The method includes preprocessing pictures, feature extraction, the use of feature pyramid networks and object detection boxes, optimizing network structures to improve model accuracy and speed.
It realizes accurate detection of PDF documents in multiple formats, categories and languages, can distinguish titles more carefully, and is suitable for scanning documents, improves the accuracy and speed of the layout detection algorithm model, and reduces the complexity and operation of the model. time.
Smart Images

Figure CN114663904B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a PDF document layout detection method, device, equipment and medium. Background Art
[0002] At present, with the development of informatization, more and more offices use electronic documents in the portable document format PDF (Portable Document Format) for communication. This format file encapsulates text, fonts, formats, colors, and graphics and images independent of equipment and resolution in one file. It has high integration and security and reliability. This feature makes it an ideal document format for electronic document distribution and digital information dissemination on the Internet.
[0003] Although these electronic documents are easy to use and spread, it is very difficult and challenging to achieve unified document layout detection due to the complexity of understanding document layout and extracting information using this format. In addition, PDF documents have different languages (Chinese, English, etc.), different typesetting formats, different document formats (scanned, text), different font types and sizes, and different industry fields. Therefore, it is difficult to automatically process and detect these documents. Existing PDF document parsing tools can achieve document layout detection to a certain extent, but most of the existing algorithms are trained on a specific type of PDF document data, such as English papers and Chinese journals, and cannot be applied to other industries and fields with large differences in content formats. For example, it is impossible to achieve layout detection of documents such as notices, notices, contracts, leave notes, technical reports, etc.; and existing document layout detection algorithms cannot achieve the positioning and extraction of many important objects, including six categories: titles, texts, images, tables, lists, and formulas. Most of the existing algorithms cannot achieve the positioning and extraction of formulas and lists, and the layout detection types are not rich enough; in addition, for the title extraction function, Yes, the existing algorithms cannot locate and extract multi-level titles, including: first-level titles, second-level titles, third-level titles, fourth-level titles, and various subtitles without obvious prefixes. The functions are not perfect and cannot achieve refined layout detection; the existing document layout detection algorithm based on target detection uses the Faster-Rcnn framework for training and testing. The framework model is complex, the calculation complexity is high, the running time is long, and the efficiency is low, which cannot meet the requirements of real-time layout detection; finally, the existing document layout detection algorithm based on natural language processing relies on the semantic information and position information of each character in the document, and cannot process scanned PDF documents. The application scenarios are limited, and the model is complex and the calculation amount is large.
[0004] To sum up, when detecting the layout of PDF documents, how to detect PDF documents in multiple formats, multiple categories and multiple languages, detect scanned PDF documents, and improve the accuracy and speed of the layout detection algorithm model. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a PDF document layout detection method, which can detect PDF documents of multiple formats, multiple categories and multiple languages, realize the detection of scanned PDF documents, and improve the accuracy and speed of the layout detection algorithm model. The specific scheme is as follows:
[0006] In a first aspect, the present application discloses a PDF document layout detection method, comprising:
[0007] Obtaining various historical PDF documents of preset content, preset format and preset language, and converting all pages corresponding to the historical PDF documents into images;
[0008] Annotate the target object in the picture according to the preset annotation frame to obtain an annotated picture and corresponding target annotation information; the target annotation information includes the target annotation category and the target annotation position coordinates;
[0009] The target detection point network is trained according to the labeled image and the corresponding target labeling information to obtain a training model; the target detection point network is a network for performing target detection based on key points in the image;
[0010] The PDF document to be detected is input into the training model to detect the line layout of the PDF document to be detected.
[0011] Optionally, the training of the target detection point network according to the labeled image and the corresponding target labeling information includes:
[0012] Dividing the labeled images into a training set to obtain training images, and using the target label information as a training label in a preset format for the training set;
[0013] The target detection point network is trained according to the training images and the training labels.
[0014] Optionally, the training the target detection point network according to the training image and the training label includes:
[0015] Preprocessing the training image to obtain a preprocessed image;
[0016] Inputting the preprocessed image and the training label into the MobileNet-V2 basic network in the target detection point network, so that the MobileNet-V2 basic network extracts features from the preprocessed image to obtain different initial feature maps;
[0017] Inputting the different initial feature maps into a feature pyramid network in the target detection point network, so that the feature pyramid obtains different enhanced feature maps based on output channels of a preset number of channels;
[0018] Detect the center point of the target object and a preset number of boundary points, and use the center point and the boundary points as key points for constituting a target detection frame, then perform target detection on the enhanced feature map based on the target detection frame, and output target detection information.
[0019] Optionally, preprocessing the training image to obtain a preprocessed image includes:
[0020] The side length of the training image is adjusted to a preset length range to obtain an adjusted training image, and the RGB three channels of the adjusted training image are normalized to obtain a processed training image, and then the processed training image is padded and randomly horizontally flipped to obtain a preprocessed image.
[0021] Optionally, performing target detection on the enhanced feature map based on the target detection frame and outputting target detection information includes:
[0022] Taking each pixel point of the enhanced feature map as the center, predicting the pre-regression offset of the key point in the target object, and performing a first convolution operation based on the pre-regression offset to complete the first-stage offset regression to obtain the post-regression offset, and then performing a second convolution operation based on the enhanced feature map and the post-regression offset to obtain a new feature map, and inputting the new feature map into the classification layer to obtain a category score map; the target detection category is indicated in the category score map;
[0023] Performing a first convolution operation based on the new feature map to complete the second stage offset regression, combining the first stage offset and the second stage offset to obtain a target offset, and then determining the target position coordinates based on the target offset;
[0024] Output the target detection information including the target detection category and the target position coordinates.
[0025] Optionally, the training of the target detection point network according to the labeled image and the corresponding target labeling information to obtain a training model includes:
[0026] Based on the target detection information and the training labels, a first loss function is used to calculate the category loss, a second loss function is used to calculate the position coordinate loss, and a third loss function is used to calculate the target detection box loss; wherein the training labels include the training object category and the training object position coordinates, the category loss represents the difference between the target detection category and the training object category, the position coordinate loss represents the difference between the target detection position coordinates and the training object position coordinates, and the target detection box loss represents the difference between the target detection box and the preset annotation box;
[0027] According to the category loss, the position coordinate loss and the target detection box loss, the target detection point network is optimized and trained using a stochastic gradient descent algorithm with a preset number of iterations, a preset weight decay and a preset initial learning rate to update the model parameters to obtain a training model.
[0028] Optionally, after training the target detection point network according to the labeled image and the corresponding target labeling information to obtain a training model, the method further includes:
[0029] Post-processing the target detection frame using a non-maximum suppression algorithm to obtain a post-processing module;
[0030] The convolution process and the normalization operation in the MobileNet-V2 basic network are integrated, and the side length of the test image in the test set is adjusted to a preset value to obtain an adjusted test image;
[0031] Adjusting the training model based on the post-processing module and the fused MobileNet-V2 basic network to obtain an adjusted model;
[0032] The adjusted model is tested using the adjusted test image and the test label, so as to determine whether to continue training the training model based on the test result.
[0033] Optionally, the PDF document layout detection method further includes:
[0034] Determine a first preset ratio of the labeled image and a second preset ratio of the labeled image;
[0035] Dividing a corresponding number of the labeled images and the target labeling information into the training set according to the first preset labeled image ratio, so as to train the target detection point network using the training set to obtain the training model;
[0036] According to the second preset labeled image ratio, a corresponding number of the labeled images and the target labeling information are divided into the test set, so as to use the test set to test the training model.
[0037] In a second aspect, the present application discloses a PDF document layout detection device, comprising:
[0038] Document acquisition module, used to acquire various historical PDF documents with preset content, preset format and preset language;
[0039] An image conversion module is used to convert all pages corresponding to the historical PDF document into images;
[0040] A picture annotation module, used to annotate the target object in the picture according to a preset annotation frame to obtain an annotated picture and corresponding target annotation information; the target annotation information includes a target annotation category and a target annotation position coordinate;
[0041] A model training module, used to train a target detection point network according to the labeled image and the corresponding target annotation information to obtain a training model; the target detection point network is a network that performs target detection based on key points in the image;
[0042] The layout detection module is used to input the PDF document to be detected into the training model to perform layout detection on the PDF document to be detected.
[0043] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the processor implements the aforementioned disclosed PDF document layout detection method when executing a computer program stored in the memory.
[0044] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed PDF document layout detection method is implemented.
[0045] It can be seen that the present application obtains various historical PDF documents with preset content, preset format and preset language, and converts all pages corresponding to the historical PDF documents into pictures; annotates the target object in the picture according to the preset annotation box to obtain an annotated picture and corresponding target annotation information; the target annotation information includes the target annotation category and the target annotation position coordinates; trains the target detection point network according to the annotated picture and the corresponding target annotation information to obtain a training model; the target detection point network is a network for target detection based on key points in the picture; the PDF document to be detected is input into the training model to detect the row layout of the PDF document to be detected. It can be seen that this application obtains historical PDF documents of various preset contents, preset formats and preset languages, and uses the documents for model training, so that the obtained training model can detect PDF documents of various formats, multiple categories and multiple languages, and can also distinguish titles more finely; this application converts all pages corresponding to the historical PDF documents into pictures to realize the detection of scanned PDF documents; in addition, the target detection network based on key points is used for target detection, and the boundary position of the target object is located by key points, the influence of background factors introduced by the rectangular candidate box is removed, and multi-resolution training is adopted, so that the model accuracy is higher, and the accurate positioning and classification of important objects in the document can be realized. At the same time, the size structure of the network is optimized, so that the model runs faster, and the accuracy and speed of the layout detection algorithm model are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0047] Figure 1 A flow chart of a PDF document layout detection method provided by this application;
[0048] Figure 2 A schematic diagram of image annotation provided for this application;
[0049] Figure 3 A schematic diagram of image annotation provided for this application;
[0050] Figure 4 A schematic diagram of a PDF document layout detection result provided for this application;
[0051] Figure 5 A schematic diagram of a PDF document layout detection result provided for this application;
[0052] Figure 6 A schematic diagram of a PDF document layout detection result provided for this application;
[0053] Figure 7 A schematic diagram of a PDF document layout detection result provided for this application;
[0054] Figure 8 A specific PDF document layout detection method flow chart provided for this application;
[0055] Fig. 9 A schematic diagram of a target detection network provided for this application;
[0056] Fig.10 A schematic diagram of the structure of a PDF document layout detection device provided in this application;
[0057] Fig.11 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] The current methods for PDF document layout detection cannot be applied to other industries and fields with large differences in content formats, cannot locate and extract multiple important objects, cannot locate and extract multi-level titles, cannot process scanned PDF documents, and the framework model is complex, the calculation complexity is high, the running time is long, the efficiency is low, and it cannot meet the requirements of real-time layout detection.
[0060] In order to overcome the above problems, the present application provides a PDF document layout detection solution that can detect PDF documents in multiple formats, multiple categories and multiple languages, realize the detection of scanned PDF documents, and improve the accuracy and speed of the layout detection algorithm model.
[0061] See also Figure 1 As shown, the embodiment of the present application discloses a PDF document layout detection method, the method comprising:
[0062] Step S11: Acquire various historical PDF documents with preset contents, preset formats and preset languages, and convert all pages corresponding to the historical PDF documents into images.
[0063] In the embodiment of the present application, identifying unstructured digital documents, such as PDF, and parsing them into a machine-readable structured format is an important basis for achieving downstream tasks. Document layout detection is the process of identifying and classifying the area of interest in the scanned image of a text document, which is specifically defined as the automatic detection and positioning process of important objects in the document such as titles, text, images, formulas, lists, and tables. Based on the document layout detection results, objects of interest can be accurately and quickly extracted to achieve automatic analysis and processing of documents, laying the foundation for downstream tasks. Specifically, natural language processing tasks such as document similarity analysis, document classification, and document retrieval rely heavily on the extraction and classification of titles and texts at all levels in the document. On the other hand, some downstream tasks require analysis and classification of images and tables in documents, which requires algorithms to accurately locate, classify, and extract image and table categories in documents.
[0064] It should be pointed out that existing PDF document parsing tools can achieve document layout detection to a certain extent, such as the PDF document parsing tool pdfplumber, which can obtain detailed content and coordinate information of text, images, tables, etc. in the document. However, such tools cannot distinguish between titles and ordinary text, and cannot correctly and completely extract vector graphics, nor can they obtain objects of interest such as formulas and lists; on the other hand, such tools cannot parse scanned PDFs and have certain limitations, so they cannot provide accurate document layout detection services.
[0065] It should be pointed out that the traditional PDF document layout detection method analyzes and integrates various algorithms by parsing the internal elements of PDF, and combines independent single characters and image information into fragmented units such as titles, paragraphs, pictures, and tables that can be seen visually. Although this method can accurately extract the information of the basic elements inside PDF, it lacks a general method in the combination and assembly process, especially for content of different formats, and the labor cost is high. Some algorithms use machine learning and image processing to automatically analyze and process various areas of document images. For example, the bottom-up document layout detection algorithm first parses the document into black and white connected areas, then groups these areas into words, then into text lines, and finally into text blocks. However, this method is limited to text segmentation of document images and cannot detect and locate specific important objects such as titles, images, and tables. In recent years, with the continuous development of deep learning, document layout detection algorithms based on deep learning have achieved good research results. Its methods can be summarized into two categories: computer vision-based methods and natural language processing-based methods. Among them, the computer vision-based method makes full use of the document's layout information, as well as the color, size, position, relative relationship and other information of the text and pictures in the image to perform layout detection; the natural language processing-based method realizes document layout detection by making full use of the semantic information of the text in the document and the coordinate information.
[0066] It should be pointed out that the computer vision-based method includes encoding features through the AlexNet neural network, deconvolution plus sampling decoding features, obtaining refined segmentation results to achieve layout detection. However, this method cannot classify titles and list objects, and is prone to unclear segmentation and fuzzy effects. In addition, the model is large and cannot achieve the purpose of real-time detection. The Publaynet dataset uses the Faster-Rcnn (faster recurrent neural network) two-stage target detection method to detect and locate important objects. Due to the large amount of training data and the large number of model parameters, this method has achieved good layout detection results. However, this method is trained based on English documents and cannot fit Chinese PDF documents, and cannot detect recognition formulas and subtitles without obvious prefix features. In addition, its candidate box-based detection method requires the pre-definition of the aspect ratio of the detection box. When detecting slender target objects, it is easy for some borders to not completely contain the target object. There is a disadvantage of inaccurate regression, and the model structure is complex, the amount of calculation is large, and the running time is slow, so real-time layout detection cannot be achieved. A document information fragmentation extraction method based on visual deep learning also uses the Faster-Rcnn target detection method for layout detection. This method optimizes the sampling area, uniformly samples a small number of pixels in the input image and generates anchor boxes of different numbers and sizes at different scales with the sampling pixel center. This method cannot identify the location list category. The two-stage detection method based on anchor boxes still has the disadvantages of inaccurate detection boxes and complex model structure. The general document pre-training model method combines natural language processing and computer vision methods, fully utilizes the image information and text information of the document, and builds a powerful document layout detection pre-training framework. However, this method is not suitable for scanning PDF documents because it relies on text information. It has poor generalization and a large model framework, which is not suitable for practical use. Other document layout detection methods based on target detection can only locate and classify specific categories such as tables or images separately. They have a single function and cannot achieve fine document layout detection.
[0067] In the embodiment of the present application, according to the shortcomings of the above-mentioned existing methods for detecting the layout of PDF documents, a new method for detecting the layout of PDF documents is proposed; first, by obtaining historical PDF documents of various preset contents, preset formats and preset languages, and applying the documents to model training, the training model can be more generalized in practical applications, and can extract the layout information of various PDF documents with large layout differences, rather than being limited to journals and papers with obvious features; it can be understood that the training model can perform layout detection on documents with different content formats such as papers, notices, notices, contracts, bids, leave requests, technical reports, etc., and can detect the layout of documents including titles, texts, images, The layout detection is performed on documents with important objects such as tables, lists and formulas. The layout detection can be performed on English and Chinese documents. The first-level title, second-level title, third-level title, fourth-level title, and subtitles without obvious prefixes can be distinguished, and the ordinary text and title categories can be further refined. Then, by converting the historical PDF documents into pictures, the PDF document layout detection problem is converted into a target detection problem, which makes full use of the visual features of the document without relying on detailed information of a single character, such as semantic information and coordinate information. It is applicable to both scanned documents and text-based PDF documents, so that the training model can process scanned PDF documents and text-based PDF documents.
[0068] Step S12: labeling the target object in the picture according to a preset labeling frame to obtain a labeled picture and corresponding target labeling information; the target labeling information includes a target labeling category and a target labeling position coordinate.
[0069] In the embodiment of the present application, each stored document image is annotated by an image annotation tool, such as labelme, and the annotation effect is as follows: Figure 2 and Figure 3 As shown. First, set the categories that need to be annotated, including: title, text, image, table, list, formula, etc. The titles include first-level title, second-level title, third-level title, fourth-level title, and subtitles without obvious prefixes, etc., which comprehensively cover the important content of the document. Then, use the preset annotation box to annotate objects of each category along the edge of the target. Finally, the target annotation information containing the target annotation category and the target annotation position coordinates is obtained. The target annotation information can be stored in a file in JSON (JavaScript Object Notation, JS object notation) format, and each picture corresponds to a JSON format file.
[0070] Step S13: training a target detection point network according to the labeled image and the corresponding target labeling information to obtain a training model; the target detection point network is a network for performing target detection based on key points in the image.
[0071] In the embodiment of the present application, the target training network mainly includes three modules: a basic network, a feature pyramid network FPN (feature pyramid network), and a detection head. The basic network uses a lightweight convolutional neural network MobilenetV2 for feature extraction, and outputs feature maps of different stages in which semantic information gradually changes from low-order to high-order, the resolution of the feature map gradually decreases, and the receptive field gradually expands; among them, the MobilenetV2 basic network is pre-trained on the large image classification dataset imagenet, and is widely used in deployment environments with general hardware conditions, taking into account speed while achieving a satisfactory level of model accuracy; the feature pyramid network FPN mainly solves the multi-scale problem in object detection; the detection head is used for target detection.
[0072] Step S14: inputting the PDF document to be detected into the training model to perform layout detection on the PDF document to be detected.
[0073] In the embodiment of the present application, the PDF document to be detected is input into the training model to detect the line layout of the PDF document to be detected, and then the document after positioning and classification can be obtained, such as Figure 4 , Figure 5 , Figure 6 , Figure 7 As shown, the document layout detection model proposed in this application can accurately locate and classify various important categories in documents, including six categories: title, text, image, table, formula, and list. The title includes first-level title, second-level title, third-level title, and subtitle, etc. It has a wide extraction range and contains more comprehensive content. At the same time, the model can adapt to different PDF documents with large differences in content and format, including notices, announcements, papers, journals, contracts, plans, etc., and supports both scanned and text-based PDF documents. It has good generalization performance, laying a solid foundation for subsequent downstream tasks such as document similarity analysis and document retrieval. It should be pointed out that Figure 7 PDF documents taken for mobile phones, so Figure 7 Background and Figure 4 , Figure 5 and Figure 6 Although it is relatively dark, the training model is still able to detect the PDF document photographed by the mobile phone, which further illustrates that the model can handle a variety of different PDF documents with large differences.
[0074] It can be seen that the present application obtains various historical PDF documents with preset content, preset format and preset language, and converts all pages corresponding to the historical PDF documents into pictures; annotates the target object in the picture according to the preset annotation box to obtain an annotated picture and corresponding target annotation information; the target annotation information includes the target annotation category and the target annotation position coordinates; trains the target detection point network according to the annotated picture and the corresponding target annotation information to obtain a training model; the target detection point network is a network for target detection based on key points in the picture; the PDF document to be detected is input into the training model to detect the row layout of the PDF document to be detected. It can be seen that this application obtains historical PDF documents of various preset contents, preset formats and preset languages, and uses the documents for model training, so that the obtained training model can detect PDF documents of various formats, multiple categories and multiple languages, and can also distinguish titles more finely; this application converts all pages corresponding to the historical PDF documents into pictures to realize the detection of scanned PDF documents; in addition, the target detection network based on key points is used for target detection, and the boundary position of the target object is located by key points, the influence of background factors introduced by the rectangular candidate box is removed, and multi-resolution training is adopted, so that the model accuracy is higher, and the accurate positioning and classification of important objects in the document can be realized. At the same time, the size structure of the network is optimized, so that the model runs faster, and the accuracy and speed of the layout detection algorithm model are improved.
[0075] See also Figure 8 As shown, the embodiment of the present application discloses a specific PDF document layout detection method, which includes:
[0076] Step S21: Acquire various historical PDF documents with preset contents, preset formats and preset languages, and convert all pages corresponding to the historical PDF documents into images.
[0077] For a more specific processing procedure of step S21, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.
[0078] Step S22: labeling the target object in the picture according to a preset labeling frame to obtain a labeled picture and corresponding target labeling information; the target labeling information includes a target labeling category and a target labeling position coordinate.
[0079] For a more specific processing procedure of step S22, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.
[0080] Step S23: Divide the labeled pictures into a training set to obtain training pictures, and use the target labeling information as a training label in a preset format for the training set.
[0081] In the embodiment of the present application, the preset format is the COCO (Microsoft Common Objects in Context) format, and the training set label is set to the COCO format to perform object detection training.
[0082] Step S24: preprocessing the training image to obtain a preprocessed image, and inputting the preprocessed image and the training label into the MobileNet-V2 basic network in the target detection point network, so that the MobileNet-V2 basic network extracts features from the preprocessed image to obtain different initial feature maps, and then inputs the different initial feature maps into the feature pyramid network in the target detection point network, so that the feature pyramid obtains different enhanced feature maps based on the output channels of a preset number of channels.
[0083] In an embodiment of the present application, after obtaining a training image and a training label, the training image is preprocessed to obtain a preprocessed image, wherein the preprocessing includes: adjusting the side length of the training image to a preset length range to obtain an adjusted training image, and normalizing the RGB three channels of the adjusted training image to obtain a processed training image, and then padding and randomly horizontally flipping the processed training image to obtain a preprocessed image.
[0084] It should be pointed out that the method of adjusting the side length of the training image to a preset length range to obtain the adjusted training image needs to ensure that the ratio of the long side to the short side of the training image is unchanged. In addition, this method supports resolution training, which can significantly improve the accuracy of the training model without increasing the amount of computation in the training process, and enhance the generalization ability of the training model; further, in the subsequent testing process, the position coordinates and category information of the target object in the test images with large scale changes can also be accurately output.
[0085] It should be pointed out that the method of normalizing the RGB three channels of the adjusted training image to obtain the processed training image can make the distribution of the training images tend to be consistent and help the training process converge quickly; wherein the normalization processing includes subtracting the mean and dividing the variance.
[0086] It should be pointed out that the method of performing padding processing and random horizontal flipping on the processed training image to obtain the pre-processed image can achieve the purpose of data enhancement and enhance the robustness of the training model.
[0087] In an embodiment of the present application, after obtaining the preprocessed image, the preprocessed image and the training label are input into the MobileNet-V2 basic network in the target detection point network, so that the MobileNet-V2 basic network can extract features from the preprocessed image and output different feature maps in which the semantic information gradually increases from low order to high order, the resolution of the feature map gradually decreases, and the receptive field gradually expands. And after obtaining different feature maps, the different initial feature maps are input into the feature pyramid network in the target detection point network to further fuse the high-order semantic features and the low-order semantic features, so that the feature pyramid can obtain different enhanced feature maps of different resolutions based on a preset number of output channels. It should be pointed out that the preset number of channels for the output channel is 64. Setting the preset number of channels to 64 can greatly reduce the amount of calculation without affecting the accuracy of the model, thereby accelerating the training model. The specific process is as follows: Fig. 9 As shown in the figure, it is understandable that the feature pyramid mainly solves the multi-scale problem in object detection. By simply changing the network connection, the high-order feature map with low resolution is upsampled and then added and fused with the low-order feature map with higher resolution in the previous layer. The performance of small object detection is greatly improved without basically increasing the computational complexity of the original model.
[0088] Step S25: Detect the center point and a preset number of boundary points of the target object, and use the center point and the boundary points as key points for constituting a target detection frame, then perform target detection on the enhanced feature map based on the target detection frame, and output target detection information so as to use the target detection information to perform model training to obtain a training model.
[0089] In the embodiment of the present application, after obtaining different enhanced feature maps, the key point-based detection heads are respectively connected to the different enhanced feature maps for target detection, and the final positioning and classification results of six categories of titles, texts, images, tables, lists, and formulas are output. The specific process is as follows Fig. 9 Specifically, the center point of the target object and the preset number of boundary points are detected, and the center point and the boundary points are used as key points for constituting a target detection frame, and then the enhanced feature map is subjected to target detection based on the target detection frame, and target detection information is output. It should be noted that the preset number of points corresponding to the boundary points is 9.
[0090] It should be pointed out that, unlike the traditional detection method that uses the coordinates of the upper left corner and lower right corner of the rectangular frame in the image coordinate system to represent the target position information, this application uses the center point and boundary point of the target object as key points, which can more finely represent the edge of the object, and then combine the key points into a target detection frame through a certain method to achieve target detection. Subsequent classification and regression features are selected along the key points of the target, ignoring the influence of background factors on the target object, and the feature quality is higher.
[0091] In an embodiment of the present application, target detection is performed on the enhanced feature map based on the target detection frame, and the specific content of outputting the target detection information includes: taking each pixel point of the enhanced feature map as the center, predicting the pre-regression offset of the key point in the target object, and performing a first convolution operation based on the pre-regression offset to complete the first-stage offset regression to obtain the post-regression offset, and then performing a second convolution operation based on the enhanced feature map and the post-regression offset to obtain a new feature map, and inputting the new feature map into the classification layer to obtain a category score map; indicating the target detection category in the category score map; performing a first convolution operation based on the new feature map to complete the second-stage offset regression, and combining the first-stage offset and the second-stage offset to obtain the target offset, and then determining the target position coordinates based on the target offset; outputting the target detection information including the target detection category and the target position coordinates.
[0092] It should be pointed out that the first convolution operation is a common two-dimensional convolution operation, and the formula is:
[0093]
[0094] Among them, w is the convolution kernel parameter, x is the feature map to be convolved, and p0 is any spatial position of the output feature map. The size and shape of the standard 3×3 convolution kernel are defined. In the standard convolution operation, the convolution kernel action area is always within the rectangular area of the standard convolution kernel size around the center point, which cannot truly express the shape of the object.
[0095] It should be noted that the second convolution operation represents a deformable convolution, and the formula is:
[0096]
[0097] Among them, △p n |n=1,...,N is the offset, Deformed convolution is performed by adding a standard convolution kernel Add an offset △p nTo realize irregular convolution. It can be understood that, due to the introduction of the offset, the deformable convolution can express the characteristics of irregular objects and fit the shape of the object more closely, thereby better performing pixel segmentation and object detection. Specifically, since both the classification and bounding box regression in the detection head use deformable convolution, the operation takes a lot of time to run on the CPU (central processing unit). In order to ensure the operating efficiency and accuracy of the model, the number of feature channels is set to 64 in the present invention, which greatly improves the running speed of the model.
[0098] It should be pointed out that the first convolution operation is applied to the offset regression before and after the second convolution operation, so that the detection head contains two-stage key point offset regression, which further optimizes the key point regression accuracy and can improve the training model performance.
[0099] In an embodiment of the present application, after outputting the target detection information including the target detection category and the target position coordinates, based on the target detection information and the training labels, a first loss function is used to calculate the category loss, a second loss function is used to calculate the position coordinate loss, and a third loss function is used to calculate the target detection box loss; wherein the training labels include the training object category and the training object position coordinates, the category loss represents the difference between the target detection category and the training object category, the position coordinate loss represents the difference between the target detection position coordinates and the training object position coordinates, and the target detection box loss represents the difference between the target detection box and the preset annotation box.
[0100] It should be noted that the first loss function is Focal Loss (FL), which is used in classification loss, and the formula is:
[0101] FL(p t )=-(1-p t ) γ log(p t );
[0102] Among them, p t is the sample classification probability, γ is the control modulation coefficient (1-p t ) γ The larger the γ value, the greater the weight given to the hard-to-classify samples by the first loss function, and the smaller the weight given to the easy-to-classify samples, which further optimizes the imbalance problem of positive and negative samples and improves the detection performance of the model. In the embodiment of the present application, the positive sample is an actual sample, and the negative sample is a suspected sample.
[0103] It should be pointed out that the second loss function is Smoth_L1_Loss, which is used in key point loss, and the formula is:
[0104]
[0105] Where x is the difference between the actual position coordinate value and the predicted position coordinate value.
[0106] Since Smoth_L1_Loss tends to be smooth at the origin, it solves the problem of gradient explosion of outliers and accelerates the convergence of the model.
[0107] It should be noted that the third loss function is GIoULoss (Generalized Intersection over Union Loss), which is used for bounding box regression. The formula is:
[0108]
[0109] Among them, A and B are the target detection box and the preset annotation box respectively, and C is a minimum closed shape that encloses A and B. The third loss function can well reflect the overlap relationship between the two boxes and has scale invariance. IoU (Intersection over Union) is the ratio of the intersection and union of A and B; GIOU means that if there are two arbitrary A and B, we want to find a minimum closed shape C so that C can enclose A and B, and then we calculate the proportion of the area in C that does not cover A and B to the total area of C, and then subtract this ratio from the IOU value of A and B.
[0110] In an embodiment of the present application, after using the first loss function to calculate the category loss, the second loss function to calculate the position coordinate loss, and the third loss function to calculate the target detection box loss, the target detection point network is optimized and trained using a stochastic gradient descent algorithm (SGD) with a preset number of iterations, a preset weight decay, and a preset initial learning rate to update the model parameters and obtain a training model.
[0111] It should be noted that when the stochastic gradient descent method is used for optimization training, the number of iterations epoch = 24, the weight decay wd (weight decay) = 0.0001, and the initial learning rate lr (learning rate) = 0.01 are set. When epochs are equal to 16 and 22 respectively, the learning rate decreases by 10 times.
[0112] In an embodiment of the present application, after optimizing and training the model to obtain the training model, the training model needs to be tested to determine whether the accuracy of the training model is sufficient. If not, continue to train the training model. The specific process is to post-process the target detection frame using a non-maximum suppression algorithm to obtain a post-processing module; fuse the convolution process and normalization operation in the MobileNet-V2 basic network, and adjust the side length of the test image in the test set to a preset value to obtain an adjusted test image; adjust the training model based on the post-processing module and the fused MobileNet-V2 basic network to obtain an adjusted model; test the adjusted model using the adjusted test image and test label to determine whether to continue training the training model based on the test results.
[0113] It should be pointed out that this application uses the mAP (mean Average Precision) indicator to measure the accuracy of the algorithm. This indicator comprehensively considers the accuracy and recall rate of the model and is an evaluation indicator widely used by target detection algorithms. First, the non-maximum suppression NMS (Non-Maximum Suppression) algorithm is used to post-process the target detection frame to obtain a post-processing module, in which the score threshold is set to 0.05, the overlap index IOU (Intersection over Union) threshold of the frame is set to 0.1, and the maximum number of detection frames for a single image is set to 100; then the test set resolution is set to a fixed size, that is, the short side is 600. At the same time, in order to improve the detection speed, the convolution and normalization BN (batchnormalization) operations in the MobilenetV2 basic network are fused. After the test is completed, if the mAP value of the training model on the test set reaches 56.7%, the test time of a single document image on the CPU is 0.4~0.5s, and the model size is 22M, it meets the real-time processing and accuracy requirements of document layout detection, and can accurately locate and classify important categories in PDF document images.
[0114] In the embodiment of the present application, since a training set is used for training to obtain a training model and a test set is used to test the training model, it is necessary to divide the labeled pictures into a training set and a test set. Specifically, a first preset labeled picture ratio and a second preset labeled picture ratio are determined; a corresponding number of the labeled pictures and the target annotation information are divided into the training set according to the first preset labeled picture ratio, so that the training set is used to train the target detection point network to obtain the training model; a corresponding number of the labeled pictures and the target annotation information are divided into the test set according to the second preset labeled picture ratio, so that the training model is tested using the test set.
[0115] Step S26: inputting the PDF document to be detected into the training model to perform layout detection on the PDF document to be detected.
[0116] For a more specific processing procedure of step S26, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.
[0117] It can be seen that the present application obtains various historical PDF documents with preset contents, preset formats and preset languages, and converts all pages corresponding to the historical PDF documents into pictures; annotates the target objects in the pictures according to preset annotation boxes to obtain annotated pictures and corresponding target annotation information; the target annotation information includes target annotation categories and target annotation position coordinates; divides the annotated pictures into training sets to obtain training pictures, and uses the target annotation information as training labels in a preset format for the training sets; preprocesses the training pictures to obtain preprocessed pictures, and inputs the preprocessed pictures and the training labels into the MobileNet-V2 basic network in the target detection point network, so that the MobileNet The eNet-V2 basic network extracts features from the preprocessed image to obtain different initial feature maps, and then inputs the different initial feature maps into the feature pyramid network in the target detection point network, so that the feature pyramid obtains different enhanced feature maps based on the output channels of the preset number of channels, detects the center point of the target object and a preset number of boundary points, and uses the center point and the boundary points as key points for constituting a target detection frame, and then performs target detection on the enhanced feature map based on the target detection frame, and outputs target detection information, so as to use the target detection information to perform model training to obtain a training model; the PDF document to be detected is input into the training model to perform layout detection on the PDF document to be detected. As can be seen from this. This application obtains historical PDF documents of various preset contents, preset formats and preset languages, and uses the documents for model training, so that the obtained training model can detect PDF documents of various formats, categories and languages, and can also distinguish titles more finely; this application converts all pages corresponding to the historical PDF documents into pictures to detect scanned PDF documents; in addition, a target detection network based on key points is used for target detection, the boundary position of the target object is located by key points, and a two-stage key point offset regression is performed using an ordinary two-dimensional convolution algorithm, and features are extracted using deformation convolution for positioning and identification, removing the influence of background factors introduced by rectangular candidate boxes and adopting multi-resolution training, so that the model has higher accuracy and can achieve accurate positioning and classification of important objects in documents. At the same time, the size structure of the network is optimized, so that the model runs faster, and the accuracy and speed of the layout detection algorithm model are improved.
[0118] See also Fig.10 As shown, the embodiment of the present application discloses a PDF document layout detection device, including:
[0119] The document acquisition module 11 is used to acquire various historical PDF documents with preset contents, preset formats and preset languages;
[0120] The image conversion module 12 is used to convert all pages corresponding to the historical PDF document into images;
[0121] The image annotation module 13 is used to annotate the target object in the image according to a preset annotation frame to obtain an annotated image and corresponding target annotation information; the target annotation information includes a target annotation category and a target annotation position coordinate;
[0122] A model training module 14 is used to train a target detection point network according to the labeled image and the corresponding target labeling information to obtain a training model; the target detection point network is a network for target detection based on key points in the image;
[0123] The layout detection module 15 is used to input the PDF document to be detected into the training model to perform layout detection on the PDF document to be detected.
[0124] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0125] It can be seen that the present application obtains various historical PDF documents with preset content, preset format and preset language, and converts all pages corresponding to the historical PDF documents into pictures; annotates the target object in the picture according to the preset annotation box to obtain an annotated picture and corresponding target annotation information; the target annotation information includes the target annotation category and the target annotation position coordinates; trains the target detection point network according to the annotated picture and the corresponding target annotation information to obtain a training model; the target detection point network is a network for target detection based on key points in the picture; the PDF document to be detected is input into the training model to detect the row layout of the PDF document to be detected. It can be seen that this application obtains historical PDF documents of various preset contents, preset formats and preset languages, and uses the documents for model training, so that the obtained training model can detect PDF documents of various formats, multiple categories and multiple languages, and can also distinguish titles more finely; this application converts all pages corresponding to the historical PDF documents into pictures to realize the detection of scanned PDF documents; in addition, the target detection network based on key points is used for target detection, and the boundary position of the target object is located by key points, the influence of background factors introduced by the rectangular candidate box is removed, and multi-resolution training is adopted, so that the model accuracy is higher, and the accurate positioning and classification of important objects in the document can be realized. At the same time, the size structure of the network is optimized, so that the model runs faster, and the accuracy and speed of the layout detection algorithm model are improved.
[0126] Furthermore, an embodiment of the present application also provides an electronic device, Fig.11 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0127] Fig.11 The present invention is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, an input / output interface 24, a communication interface 25, and a communication bus 26. The memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps of the PDF document layout detection method disclosed in any of the aforementioned embodiments.
[0128] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 24 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0129] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The memory 22 can include a random access memory as a running memory and a non-volatile memory for external memory storage purposes. The storage resources thereon include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0130] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 on the source host and the computer program 222. The operating system 221 can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the PDF document layout detection method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0131] In this embodiment, the input and output interface 24 may specifically include but is not limited to a USB interface, a hard disk reading interface, a serial interface, a voice input interface, a fingerprint input interface, and the like.
[0132] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed PDF document layout detection method is implemented.
[0133] For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0134] The computer-readable storage medium mentioned here includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, magnetic disk or optical disk or any other form of storage medium known in the technical field. Wherein, the computer program implements the aforementioned PDF document layout detection method when executed by the processor. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0135] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the PDF document layout detection method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0136] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0137] The steps of the algorithm described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0138] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0139] The above is a detailed introduction to a PDF document layout detection method, device, equipment and medium provided by the present invention. In this article, specific examples are used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A PDF document layout detection method, characterized in that: include: Obtaining various historical PDF documents of preset content, preset format and preset language, and converting all pages corresponding to the historical PDF documents into images; Annotate the target object in the picture according to the preset annotation frame to obtain an annotated picture and corresponding target annotation information; the target annotation information includes the target annotation category and the target annotation position coordinates; The target detection point network is trained according to the labeled image and the corresponding target labeling information to obtain a training model; the target detection point network is a network for performing target detection based on key points in the image; Inputting the PDF document to be detected into the training model to detect the line layout of the PDF document to be detected; The training of the target detection point network according to the labeled image and the corresponding target labeling information includes: Dividing the labeled images into a training set to obtain training images, and using the target label information as a training label in a preset format for the training set; Training the target detection point network according to the training images and the training labels; The step of training the target detection point network according to the training images and the training labels includes: Preprocessing the training image to obtain a preprocessed image; Inputting the preprocessed image and the training label into the MobileNet-V2 basic network in the target detection point network, so that the MobileNet-V2 basic network extracts features from the preprocessed image to obtain different initial feature maps; Inputting the different initial feature maps into a feature pyramid network in the target detection point network, so that the feature pyramid obtains different enhanced feature maps based on output channels of a preset number of channels; Detecting a center point of the target object and a preset number of boundary points, and using the center point and the boundary points as key points for constituting a target detection frame, and then performing target detection on the enhanced feature map based on the target detection frame, and outputting target detection information; The performing target detection on the enhanced feature map based on the target detection frame and outputting target detection information includes: Taking each pixel point of the enhanced feature map as the center, predicting the pre-regression offset of the key point in the target object, and performing a first convolution operation based on the pre-regression offset to complete the first-stage offset regression to obtain the post-regression offset, and then performing a second convolution operation based on the enhanced feature map and the post-regression offset to obtain a new feature map, and inputting the new feature map into the classification layer to obtain a category score map; the target detection category is indicated in the category score map; Performing a first convolution operation based on the new feature map to complete the second stage offset regression, combining the first stage offset and the second stage offset to obtain a target offset, and then determining the target position coordinates based on the target offset; Output the target detection information including the target detection category and the target position coordinates.
2. The PDF document layout detection method according to claim 1, characterized in that: The preprocessing of the training image to obtain a preprocessed image includes: The side length of the training image is adjusted to a preset length range to obtain an adjusted training image, and the RGB three channels of the adjusted training image are normalized to obtain a processed training image, and then the processed training image is padded and randomly horizontally flipped to obtain a preprocessed image.
3. The PDF document layout detection method according to claim 1, characterized in that: The training of the target detection point network according to the labeled image and the corresponding target labeling information to obtain a training model includes: Based on the target detection information and the training labels, a first loss function is used to calculate the category loss, a second loss function is used to calculate the position coordinate loss, and a third loss function is used to calculate the target detection box loss; wherein the training labels include the training object category and the training object position coordinates, the category loss represents the difference between the target detection category and the training object category, the position coordinate loss represents the difference between the target detection position coordinates and the training object position coordinates, and the target detection box loss represents the difference between the target detection box and the preset annotation box; According to the category loss, the position coordinate loss and the target detection box loss, the target detection point network is optimized and trained using a stochastic gradient descent algorithm with a preset number of iterations, a preset weight decay and a preset initial learning rate to update the model parameters to obtain a training model.
4. The PDF document layout detection method according to claim 1, characterized in that: After training the target detection point network according to the labeled image and the corresponding target labeling information to obtain a training model, the method further includes: Post-processing the target detection frame using a non-maximum suppression algorithm to obtain a post-processing module; The convolution process and the normalization operation in the MobileNet-V2 basic network are integrated, and the side length of the test image in the test set is adjusted to a preset value to obtain an adjusted test image; Adjusting the training model based on the post-processing module and the fused MobileNet-V2 basic network to obtain an adjusted model; The adjusted model is tested using the adjusted test image and the test label, so as to determine whether to continue training the training model based on the test result.
5. The PDF document layout detection method according to any one of claims 1 to 4, characterized in that: Also includes: Determine a first preset ratio of the labeled image and a second preset ratio of the labeled image; Dividing a corresponding number of the labeled images and the target labeling information into the training set according to the first preset labeled image ratio, so as to train the target detection point network using the training set to obtain the training model; According to the second preset labeled image ratio, a corresponding number of the labeled images and the target labeling information are divided into the test set, so as to use the test set to test the training model.
6. A PDF document layout detection device, characterized in that: include: Document acquisition module, used to acquire various historical PDF documents with preset content, preset format and preset language; An image conversion module is used to convert all pages corresponding to the historical PDF document into images; A picture annotation module, used to annotate the target object in the picture according to a preset annotation frame to obtain an annotated picture and corresponding target annotation information; the target annotation information includes a target annotation category and a target annotation position coordinate; A model training module, used to train a target detection point network according to the labeled image and the corresponding target annotation information to obtain a training model; the target detection point network is a network that performs target detection based on key points in the image; A layout detection module, used for inputting a PDF document to be detected into the training model to perform layout detection on the PDF document to be detected; The model training module is specifically used to divide the labeled images into training sets to obtain training images, and use the target labeling information as training labels in a preset format for the training set; Training the target detection point network according to the training images and the training labels; The model training module is further used to preprocess the training image to obtain a preprocessed image; Inputting the preprocessed image and the training label into the MobileNet-V2 basic network in the target detection point network, so that the MobileNet-V2 basic network extracts features from the preprocessed image to obtain different initial feature maps; Inputting the different initial feature maps into a feature pyramid network in the target detection point network, so that the feature pyramid obtains different enhanced feature maps based on output channels of a preset number of channels; Detecting a center point of the target object and a preset number of boundary points, and using the center point and the boundary points as key points for constituting a target detection frame, and then performing target detection on the enhanced feature map based on the target detection frame, and outputting target detection information; The model training module is further used to predict the pre-regression offset of the key point in the target object with each pixel of the enhanced feature map as the center, and perform a first convolution operation based on the pre-regression offset to complete the first-stage offset regression to obtain the post-regression offset, and then perform a second convolution operation based on the enhanced feature map and the post-regression offset to obtain a new feature map, and input the new feature map into the classification layer to obtain a category score map; the target detection category is indicated in the category score map; Performing a first convolution operation based on the new feature map to complete the second stage offset regression, combining the first stage offset and the second stage offset to obtain a target offset, and then determining the target position coordinates based on the target offset; Output the target detection information including the target detection category and the target position coordinates.
7. An electronic device, characterized in that: The method comprises a processor and a memory; wherein the processor implements the PDF document layout detection method according to any one of claims 1 to 5 when executing the computer program stored in the memory.
8. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the PDF document layout detection method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Visual deep learning-based document information fragmentation extraction method
CN110991403A
Image processing method, device and equipment and computer storage medium
CN113591967A