{'fraction_non_alphanumeric': 0.035533337836924944, 'fraction_numerical': 0.011078835371208538, 'mean_word_length': 4.8054901960784315, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Document Layout Analysis with Aesthetic-Guided Image Augmentation

Document layout analysis (DLA) plays an important role in information extraction and document understanding. At present, document layout analysis has reached a milestone achievement, however, document layout analysis of non-Manhattan is still a challenge. In this paper, we propose an image layer modeling method to tackle this challenge. To measure the proposed image layer modeling method, we propose a manually-labeled non-Manhattan layout fine-grained segmentation dataset named FPD. As far as we know, FPD is the first manually-labeled non-Manhattan layout fine-grained segmentation dataset. To effectively extract fine-grained features of documents, we propose an edge embedding network named L-E^3Net. Experimental results prove that our proposed image layer modeling method can better deal with the fine-grained segmented document of the non-Manhattan layout.


INTRODUCTION
Document layout analysis (DLA) task usually uses semantic segmentation technology to divide images, tables, text, and background in the document layout into different areas, and DLA is a pixel-level classification. DLA plays an important role in document content understanding and Information extraction, such as optical character recognition (OCR), biomedical event extraction, handwriting recognition, and knowledge extraction [1].
At present, DLA has reached a milestone achievement, especially for the processing of Manhattan layout documents (i.e. academic documents) [2,3,4]. However, with the improvement of people aesthetics, document design is no longer limited to simple Manhattan layouts [5], to pursue aesthetics, designers began to use more non-Manhattan layouts (i.e. magazine pages) [6]. In addition, the processing of non-Manhattan document layout is the main bottleneck restricting the development of DLA [7,8,9].
Previously, researchers focused on non-Manhattan layout document layouts, and ignored the processing of non-Manhattan layout document layouts [9]. Therefore, the cur- rent large-scale datasets used for network training belong to the way of Manhattan document layout (i.e. Publaynet [10], DocBank [11], CS-150 [12]). Large-scale datasets dedicated to non-Manhattan document layout research have not yet been proposed.
The central issue addressed in this paper is the following: How do we construct a non-Manhattan layout documents handle method and conduct evaluate this method effectively?
Manual labeling of data is labor-intensive, and labeling throughput is limited [13]. Especially for the non-Manhattan layout document sample. Most of the current work uses synthetic data instead of manual annotation (i.e. use LATEX as the engine [14], LayoutGAN [15], layoutVAE [16]). Following this work, we also hope to use a novel model that does not require manual intervention to generate new examples. In contrast to previous works that use engines for synthetic data, our framework employs the image layer modeling [17], we show examples in Fig. 1. Compared with the previous method of using engine synthesis, use the image layer modeling has stronger flexibility and robustness. In addition, the image layer modeling also strictly follows aesthetic standards to be able to produce more natural samples. In this paper, we propose a method based on layer modeling, which is built upon the Aesthetic-Guided [18] and copy-paste [19]. In addition, the non-Manhattan layout datasets are all marked by rectangular boxes, and the results obtained by such marking are inaccurate. So we re-annotated a new dataset using point-based annotation to evaluate the processing effect of non-Manhattan layout documents.
To summarize, the highlights of this paper are: (1) We propose a novel image layer modeling method for the DLA model by incorporating image layer modeling and aestheticguided; (2) We propose a new fine-grained page semantic dataset using point annotation to evaluate the analysis effect of non-Manhattan layout documents; (3) We propose a lightweight edge enhancement network to better process non-Manhattan layout documents; (4) Extensive evaluation on two DLA datasets with very competitive results of the proposed image layer modeling approach.

RELATED WORK
Document layout analysis. DLA tasks can be divided into traditional methods and methods based on deep learning [1]. The traditional method uses the image processing to analyze the document layout(i.e.Voronoi-Based Analysis [20], Delaunay Triangulation Analysis [21], Run Length Smearing Algorithm [22], and DLA Projection Profile [23]).
With the development of deep learning, more and more deep learning-based DLA algorithms have been proposed, and these algorithms have achieved milestone results due to their superior characteristics. The primary challenge of deep learning methods is that deep learning models need to be driven by many data. Many researchers have explored different aspects to obtain a large amount of data. Zhong et al. [10] develop the PubLayNet dataset for DLA by automatically matching the XML representations. Li et al. [11] presents a benchmark dataset named DocBank that contains 500K document pages with fine-grained token level annotations for DLA. Some researchers solve this challenge by using the method of generating samples. Li et al. [15] proposed a method named LayoutGAN that synthesizes layouts samples by modeling geometric relations of different types of 2D elements. Yang et al. [14] used LATEX as the engine to synthesize data, control the synthesis parameters through programs to generated many examples with annotations. However, the previous methods mostly focused on synthesizing the Manhattan layout examples, ignoring the non-Manhattan layout examples that exist in the current document.
Data augmentation. Data enhancement is an effective means to solve data limitations by expanding the data space. The image augmentation algorithms include mixing images, random erasing, generative adversarial networks, geometric transformations, color space augmentations, kernel filters, feature space augmentation, adversarial training, neural style transfer, and meta-learning [24]. To facilitate the training of deep learning models from limited source data, Salehinejad et al. [25] proposed a sampling method based on the radical transformation in the polar coordinate system for image enhancement. Through systematic research, Ghiasi et al. [19] found that the simple mechanism of randomly pasting objects is good enough and can provide reliable benefits on top of a strong baseline. In addition, a copy-paste and semi-supervised method are proposed to utilize additional data through pseudo-labels. Following these excellent works, we employ the image layer modeling [17] for modeling to obtain a more realistic non-Manhattan document layout.

METHOD
In this section, we will introduce our framework and the details of the image layer modeling based on aesthetic guidance.

Framework
Following [26], in the document layout analysis task, the edge of the image will provide richer information, especially for the non-Manhattan layout documents. The non-Manhattan layout document has more flexible and changeable edges, which can embedding richer information than the Manhattan layout document. Following the work of E 3 N et [26], we designed a more lightweight model named L-E 3 N et for processing non-Manhattan layout document, the parameter of the L-E 3 N et is only 0.7 M. The architecture of the L-E 3 N et is shown in Fig. 2.

Image layer modeling
At present, most of the work focuses on the Manhattan layout document, paid less attention to the non-Manhattan layout document. However, in the real world, dealing with the Manhattan layout document is a challenge. There are currently fewer documents with a non-Manhattan layout, so data expansion is the most effective solution. However, the cost of data labeling for non-Manhattan layouts is expensive. In this regard, we designed a data generation method based on the image layer inspired by Aesthetic-Guided and copy-paste. As shown in Fig. 3-Left, unlike the previous method, we no longer stitch text, tables, and images by the puzzle. After the image is stored, it can only be stored in a rectangular manner, so direct stitching the image can only obtain the Manhattan layout document. To tackle this challenge, we used the concept of the image layer. As shown in Fig. 1, we first paste the text on the blank layout, and then cycle to select the appropriate position to paste the picture (supervise with some concepts of aesthetics), and finally get the layout effect shown in Fig. 3-Left. Specifically, our aesthetic guidance includes the following tasks. First, we ensure the relative size of the image during the process of pasting the image. We scale it according to the ratio, and the image size scaling factor is randomly selected within the interval [0.6, 1]; secondly, to ensure image layering, we randomly select image number is (0,8] and superimposition these images; finally, to ensure the consistency of superimposed images, we measure the similarity of images during the image superimposition process, and the measurement process is represented by Equ. 1. Suppose there are two image s (m s ×n s ) and g (m g ×n g .), we use τ m,n to represent the value of the image on m, n. We measure the similarity of images by Equ. 1.

Fine-grained annotations
To measure the effectiveness of our method, we re-annotated a fine-grained page semantic structure extraction dataset (FPD). We use the CVAT 1 labeling platform for data labeling.
To obtain fine-grained labeling information, we use point labeling in the labeling process. As shown in Fig. 3-Right, it is very different from the rectangle or polygon labeling that is usually used at present. The use of point labeling can mark the target object more prominently. To ensure the quality of labeling, we used a cross-check and review mechanism, we exported the label format to "cvat for images 1.1 formats " [27]. We will publish all datasets, it includes the train data by using image layer modeling and the test data (FPD).

EXPERIMENTS
In this section, we will introduce the experimental setup and evaluate the performance of the proposed framework.

Experiment setup
Datasets. FPD is the first manual annotated dataset that focuses on fine-grained segmentation. FPD consists of 66 non-Manhattan layout layouts document, which is manually annotated. In the labeling process, we use point labeling and polygon labeling, and the label export style is "cvat for images 1 https://github.com/openvinotoolkit/cvat 1.1". The data comes from the pages of complex Chinese and English magazines, and the page size is not fixed. DSSE-200 [14] is a comprehensive dataset that includes various dataset styles. It contains 200 images, including pictures, PPT, brochure documents, old newspapers, and scan files with light changes.
Implementation details. Our model is implemented using PyTorch [28]. We use the synthetic dataset to train the model, and use the FPD and DSSE-200 datasets as testset. In order to verify the effectiveness of our method, we synthesized some data using the LATEX-based synthesis method. Specifically, we synthesized 6000 images using the LATEX-based synthesis method [26], and synthesized 6000 images using image layer modeling. We use L D to represent the network, we use D represents the dataset used for training, M represents the use of 3000 images that generated by LATEX and 3000 images generated by image layer modeling, L represents the use of 6000 images synthesized by LATEX, and I represents the use of 6000 images synthesized by image layer modeling.
We use the cross-entropy loss function (Eq. 2) train model and use Adam as the optimizer, we set the learning rate to 1e −3 .
where x ∈ R N is the activation value without softmax, N is the feature dimension of x, and the label ∈ [0, C − 1] is the scalar of the corresponding label. C is the number of classifications to be classified. w ∈ R C represents the label weight.

Results and discussion
FPD. We also conducted experiments on FPD, and the results are shown in Table 1. From the results in Table 1, it can be seen that the use of layer-based sample synthesis can bring a significant improvement (67% vs. 70%). We show the visualization results as shown in Fig. 4. It can be seen that image layer modeling has a significant effect on determining the non-Manhattan layout area.
Comparison with prior arts. To verify the model and evaluate the layer modeling methods, we reproduced some classic methods and compared them with L-E 3 N et. We show the results in Table 2. As can be seen from  Table 1, it can be seen that the effect of the model trained with the image layer modeling dataset is not as good as the model trained  with only the LATEX synthetic dataset. We visualized the results and showed them in Fig. 5. From the visualized results, it can be seen that the reason for this result is because DSSE is a dataset in Manhattan layout labeling, and its ground-true is based on regional division. But using image layer modeling data will focus on fine-grained classification. We evaluate based on pixels, the result will be worse after calculation than use the LATEX synthetic dataset. However, it can be seen from Fig. 5 that the granularity of the divided regions of the model trained using the hybrid method is more significant for the detailed information.

Ablation study
Layer-based modeling. It is not difficult to see from Table 1 that the use of layer modeling can better handle non-Manhattan layout examples. It is worth pointing out that our generation method is under the guidance of aesthetics. We use non-aesthetic guidance to generate the dataset, and found that the result is not as good as the data set using aesthetics guidance (65% vs. 70%).
Model architecture. As we showed in Table 2, when the data reaches a certain level, the performance gap between the frameworks is not particularly obvious, so we chose a  lightweight L-E 3 N et. From the processing results, due to the consideration of edge information, the detailed processing of L-E 3 N et is also somewhat competitive.

CONCLUSIONS
In this paper, we proposed an unsupervised layer-based data synthesis method to tackle the document layout analysis task of non-Manhattan layouts, which is carried out under the guidance of aesthetic design principles. To better capture the information of non-Manhattan layout documents, we propose a lightweight edge embedding network. To better measure the proposed methods and models, this paper proposes a handlabeled fine-grained document layout analysis data set for the first time. The experimental results show that our method can better help the model to analyze the document layout.