A painting recognition method, device, storage medium and computing device

By identifying the layout structure of uneditable text through the preset layout recognition model and semantic segmentation network, combined with the discriminator network training model, the problem of layout structure complexity and information loss in non-editable text recognition is solved, and automatic recognition and layout restoration are achieved.

CN112434568BActive Publication Date: 2024-09-17BEIJING PERFECT KNOWLEDGE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011232239.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-06
Publication Date
2024-09-17
Estimated Expiration
2040-11-06

AI Technical Summary

Technical Problem

Existing non-editable text recognition technology is difficult to effectively extract image and text information, cannot adapt to complex layout structures, loses original physical structure information, lacks generalization capabilities, and requires manual participation.

Method used

Use a preset layout recognition model to identify the layout structure of uneditable text, analyze layout units through the semantic segmentation network and Otsu algorithm, train the semantic segmentation model combined with the discriminator network, find matching layout templates based on the layout structure and attribute information, and adjust the border template to Restore the original layout structure.

Benefits of technology

Complex layout structures can be identified without manual intervention, which improves recognition efficiency and generalization capabilities. It can effectively restore the layout structure of uneditable text and conform to the characteristics of paintings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112434568B
    Figure CN112434568B
Patent Text Reader

Abstract

The present invention provides a method, device, storage medium and computing device for painting recognition, the method comprising obtaining uneditable text containing paintings, using a preset layout recognition model to recognize the layout structure of the uneditable text, the layout structure comprising painting units and other types of layout units; analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units, searching for layout templates related to the painting attribute information from a preset layout template library; marking the positions of the painting units and other types of layout units, combining the painting units and other types of layout units into a layout template based on the marked position information and displaying them. The embodiment of the present invention can match a layout template suitable for the characteristics of the painting for the uneditable text containing the painting according to the attribute information of the painting, so that the recognized layout structure can not only well restore the layout structure of the original uneditable text, but also meet the characteristics of the painting in the uneditable text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text recognition technology, and in particular to a method, device, storage medium and computing equipment for painting recognition. Background Art

[0002] At present, structured data is usually carried by non-editable text, especially non-editable text containing image content. The complexity of the text itself, the diversity of publishing and printing needs, and the non-standard format editing have resulted in the current non-editable text being unable to be edited again. The image and text information cannot be extracted through conventional methods, making it impossible to effectively manage the data in the non-editable text.

[0003] Traditional non-editable text recognition requires manual participation, which is not only complex to implement, but also difficult to adapt to complex layout structures and does not have good generalization capabilities. In addition, the current recognition of non-editable text through OCR (optical character recognition) technology combined with manual operation loses the original physical structure information in the non-editable text. Summary of the invention

[0004] In view of the above problems, the present invention is proposed to provide a method, apparatus, storage medium and computing device for painting recognition that overcomes the above problems or at least partially solves the above problems, so that the recognized layout structure can not only well restore the layout structure of the original uneditable text, but also conform to the characteristics of the paintings in the uneditable text.

[0005] According to one aspect of an embodiment of the present invention, a method for identifying a painting is provided, comprising:

[0006] Obtaining non-editable text containing paintings, and using a preset layout recognition model to recognize a layout structure of the non-editable text, wherein the layout structure includes painting units and other types of layout units;

[0007] Analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units, and searching for a layout template related to the painting attribute information from a preset layout template library;

[0008] The positions of the painting units and other types of layout units are marked, and based on the marked position information, the painting units and other types of layout units are combined into the layout template and displayed.

[0009] Optionally, the other types of layout units include: at least one of a text paragraph unit, a title unit, and a table unit; and / or

[0010] The painting attribute information includes at least one of the painting's genre information, subject information, material information, and time information.

[0011] Optionally, the preset layout template library stores unit border templates corresponding to different painting attribute information, and searching the preset layout template library for a layout template related to the painting attribute information includes:

[0012] Searching for a unit border template corresponding to the painting attribute information from the preset layout template library;

[0013] Obtaining the painting border template and the unit border templates corresponding to the other types of layout units from the found unit border templates;

[0014] The unit border template category includes at least one of a painting border template, a text paragraph border template, a title border template, and a table border template.

[0015] Optionally, combining the painting unit and other types of layout units into the layout template based on the marked position information and displaying them includes:

[0016] Based on the marked position information, the sizes of the painting frame template and the unit frame templates corresponding to other types of layout units are respectively adjusted;

[0017] The resized frame templates of each unit are respectively set and displayed at the positions of the painting units and other types of layout units.

[0018] Optionally, the preset layout template library stores layout frame templates with different layout structures corresponding to different painting attribute information, and searching the preset layout template library for a layout template related to the painting attribute information includes:

[0019] Searching for a layout frame template corresponding to the painting attribute information from the preset layout template library;

[0020] A layout frame template having the same layout structure as the layout structure of the non-editable text is obtained from the found layout frame templates.

[0021] Optionally, combining the painting unit and other types of layout units into the layout template based on the marked position information and displaying the same includes:

[0022] Adjusting the size of the layout frame template based on the marked position information of the painting unit and other types of layout units;

[0023] The resized layout frame template is correspondingly set at the positions of the painting units and other types of layout units.

[0024] Optionally, using a preset layout recognition model to recognize the layout structure of the non-editable text includes:

[0025] Based on the semantic segmentation network, the non-editable text containing paintings is semantically segmented to obtain painting units and other category layout units;

[0026] The borders of various layout units are identified based on the Otsu algorithm, and the layout structure of the non-editable text is analyzed according to the borders of various layout units.

[0027] Optionally, before performing semantic segmentation on the non-editable text containing the painting based on the semantic segmentation network, the method further includes:

[0028] Replacing the activation function of the semantic segmentation network with a non-saturated activation function;

[0029] Setting a convolutional template of a preset size, a preset step value, and a preset number of convolutional templates for the semantic segmentation network;

[0030] Acquire sample data including position annotation information of layout units and text lines, and perform semantic segmentation on the sample data based on the semantic segmentation network;

[0031] Inputting the semantic segmentation result of the sample data and the sample data into a discriminator network, and using the discriminator network to discriminate the difference between the semantic segmentation result of the sample data and the sample data based on a generative adversarial network structure;

[0032] The semantic segmentation network is trained according to the discrimination difference results.

[0033] Optionally, analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units includes:

[0034] Using a preset layout recognition model to recognize the position of the text line contained in the other types of layout units, and marking the position of the text line;

[0035] The text content in each marked text line is identified by a text recognition model, and the painting attribute information corresponding to the painting unit is analyzed according to the text content.

[0036] Optionally, using a preset layout recognition model to recognize the position of a text line contained in the other types of layout units includes:

[0037] Cut out other types of layout units by using image cutting method according to the layout structure;

[0038] Recognize the character borders of each character contained in each layout unit of other categories of layout units based on the Otsu algorithm;

[0039] Merge the borders of characters belonging to the same text line to obtain the text frame of each text line;

[0040] The text line positions contained in the other types of layout units are analyzed based on the text frame.

[0041] Optionally, marking the positions of the painting units and other types of layout units includes:

[0042] Using a preset marking tool to mark the positions of the painting units and other types of layout units;

[0043] Among them, different layout units are distinguished by different marking methods.

[0044] Optionally, the text recognition model is constructed based on a convolutional neural network and a recurrent neural network. Before the text content in each marked text line is recognized by the text recognition model, the method further includes:

[0045] Obtain image data annotated with text information as training data;

[0046] Preprocessing the training data uniformly into a grayscale image of a specified size, setting a preset number of output convolutions for the last convolutional layer of the convolutional neural network, and setting a preset hidden layer size for the recurrent neural network;

[0047] Extracting image features of the training data using a convolutional neural network with a fully connected layer removed;

[0048] Recognize text information of the training data using a recurrent neural network based on the image features;

[0049] The loss function is used to calculate the recognition results of the recurrent neural network, and the text recognition model is trained based on the loss calculation results.

[0050] According to another aspect of an embodiment of the present invention, there is also provided a painting recognition device, comprising:

[0051] A recognition module, adapted to obtain non-editable text containing paintings, and use a preset layout recognition model to recognize a layout structure of the non-editable text, wherein the layout structure includes painting units and other types of layout units;

[0052] An analysis module, adapted to analyze the painting attribute information corresponding to the painting unit according to the content of other types of layout units, and search for a layout template related to the painting attribute information from a preset layout template library;

[0053] The display module is suitable for marking the positions of the painting units and other types of layout units, and combining the painting units and other types of layout units into the layout template based on the marked position information and displaying them.

[0054] According to another aspect of the embodiments of the present invention, a computer storage medium is provided, wherein the computer storage medium stores computer program code, and when the computer program code is executed on a computing device, the computing device is caused to execute the painting recognition method of any of the above embodiments.

[0055] According to another aspect of an embodiment of the present invention, there is provided a computing device, comprising: a processor; a memory storing a computer program code; when the computer program code is executed by the processor, the computing device executes the painting recognition method of any of the above embodiments.

[0056] After the embodiment of the present invention uses a preset layout recognition model to recognize the layout structure of the non-editable text containing paintings, the painting attribute information corresponding to the painting unit is analyzed according to other categories of layout units in the layout structure, and the layout template related to the painting attribute information is searched from the preset layout template library. Then, after marking the positions of the painting unit and other categories of layout units, the painting unit and other categories of layout units are combined into the layout template based on the marked position information and displayed. Therefore, for the non-editable text with a complex layout structure, the embodiment of the present invention can recognize the layout structure of the non-editable text containing paintings without human participation, which not only has a good generalization ability and improves the recognition efficiency of the layout structure, but also analyzes the attribute information of the painting in the text through the content information of other categories of layout units in the layout structure, and can match the layout template suitable for the characteristics of the painting for the non-editable text containing the painting according to the attribute information, so that the recognized layout structure can not only restore the layout structure of the original non-editable text well, but also meet the characteristics of the painting in the non-editable text.

[0057] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.

[0058] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0060] Figure 1 A schematic diagram showing a flow chart of a method for identifying a painting according to an embodiment of the present invention;

[0061] Figure 2 A schematic diagram showing a non-editable text containing a painting according to an embodiment of the present invention is shown;

[0062] Figure 3 The identification according to an embodiment of the present invention is shown Figure 2 A schematic diagram of the layout structure of the text shown;

[0063] Figure 4 The identification according to an embodiment of the present invention is shown Figure 3 A schematic diagram showing a layout structure in which a painting unit and a text paragraph unit are combined in a layout template;

[0064] Figure 5 A schematic diagram of the overall network structure of a layout recognition model according to an embodiment of the present invention is shown;

[0065] Figure 6 A schematic diagram of the structure of a painting recognition device according to an embodiment of the present invention is shown;

[0066] Figure 7 A schematic diagram showing the structure of a painting recognition device according to another embodiment of the present invention is shown;

[0067] Figure 8 A schematic structural diagram of a painting recognition device according to another embodiment of the present invention is shown. DETAILED DESCRIPTION

[0068] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0069] In order to solve the above technical problems, an embodiment of the present invention provides a painting recognition method. Figure 1 FIG. 2 is a flow chart showing a method for identifying a painting according to an embodiment of the present invention. Figure 1 , the painting recognition method includes steps S102 to S106.

[0070] Step S102, obtaining the non-editable text including the painting, and using a preset layout recognition model to recognize the layout structure of the non-editable text, where the layout structure includes a painting unit and other types of layout units.

[0071] The layout structure of the embodiment of the present invention refers to the layout structure of the non-editable text containing paintings, that is, the layout recognition model can recognize the layout structure of the non-editable text containing paintings. Among them, the layout units of the layout structure include painting units and other categories of layout units. The other categories of layout units may include at least one of text paragraph units, title units, and table units. Of course, the layout units may also be other categories, and the embodiment of the present invention does not specifically limit this. For example, the non-editable text containing paintings may include one painting unit, one title unit, and three text paragraph units.

[0072] Step S104, analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units, and searching for a layout template related to the painting attribute information from a preset layout template library.

[0073] The painting attribute information of the embodiment of the present invention may include at least one of the genre information, subject information, material information, and time information (such as the age of the painting, etc.) of the painting. The painting attribute information corresponding to the painting unit can be analyzed based on the content in other categories of layout units. For example, other categories of layout units include title units and text paragraph units, and the attribute information of the painting in the uneditable text can be analyzed based on the title unit and the text paragraph unit. Furthermore, the relevant layout template is searched from the preset layout template library based on the painting attribute information, and different layout templates in the preset layout template library are pre-created based on different painting attribute information.

[0074] Step S106, marking the positions of the painting units and other types of layout units, combining the painting units and other types of layout units into a layout template based on the marked position information and displaying them.

[0075] The embodiments of the present invention can identify the layout structure of uneditable text containing paintings without human intervention for uneditable text with complex layout structure. It not only has good generalization ability and improves the recognition efficiency of layout structure, but also analyzes the attribute information of paintings in the text through the content information of other categories of layout units in the layout structure. It can match the uneditable text containing paintings with a layout template suitable for the characteristics of the painting based on the attribute information, so that the identified layout structure can not only restore the layout structure of the original uneditable text well, but also meet the characteristics of the paintings in the uneditable text.

[0076] The recognition models applied in the embodiments of the present invention are all models after deep learning. The deep learning model can adopt the Tensorflow (a symbolic mathematical system based on data flow programming) framework. The training process of the recognition model will be specifically introduced later.

[0077] In one embodiment of the present invention, the preset layout template library pre-stores unit border templates corresponding to different painting attribute information, and the categories of unit border templates may include painting border templates, text paragraph border templates, title border templates, table border templates, etc. Different styles of unit border templates of different categories may be provided. For example, in order to highlight the content of the painting, the painting border template style is set to be relatively simple. For another example, in order to comprehensively consider the problem that the text paragraph may be boring to read, the text paragraph border template style is set to be relatively complex and vivid.

[0078] When executing step S104 above and searching for layout templates related to the painting attribute information from the preset layout template library, you can first search for the unit border template corresponding to the painting attribute information from the preset layout template library, and then obtain the painting border template and the unit border templates corresponding to other types of layout units from the searched unit border templates.

[0079] For example, Figure 2 The layout structure of the non-editable text containing the painting shown is obtained by using the layout recognition model. Figure 3 As shown, the layout structure includes a painting unit 12 and a text paragraph unit 13. By analyzing the content of the text paragraph unit, it is obtained that the painting attribute information corresponding to the painting unit is "1960s", so the unit border template related to "1960s" is searched from the preset layout template library. The unit border template related to "1960s" contains elements with the characteristics of the 1960s, such as the five-star red flag, five-pointed stars, red ribbons and other elements. Then, the painting border template and the text paragraph border template are selected from the found unit border templates related to "1960s". Then, as Figure 4 As shown, the painting border template can be combined with the painting unit, and the text paragraph border template can be combined with the text paragraph edge unit.

[0080] The present invention locates the age information of the painting content by identifying the painting content and the painting text. The painting frame template of the present invention corresponds to a time axis with ages, and there are painting style branches in different ages on the time axis. The present invention obtains the painting frame template that best matches the age of the painting by identifying the age of the painting content and matching the time axis of the painting frame template library.

[0081] In this embodiment, the selected painting frame template and text paragraph frame template can be one or more respectively. If the selected unit frame template of any type contains more than one, the user can make the final independent selection.

[0082] When executing step S106, the embodiment of the present invention can also adjust the sizes of the painting frame template and the unit frame templates corresponding to other types of layout units based on the marked position information, and then set the resized unit frame templates at the positions of the painting units and other types of layout units and display them. By adjusting the size of the unit frame template (such as the proportion size, size, etc.), the unit frame template can be made more suitable for the size of the corresponding layout unit.

[0083] In one embodiment of the present invention, layout border templates with different layout structures corresponding to different painting attribute information are pre-stored in the preset layout template library. When executing the above step S104 and searching for layout templates related to the painting attribute information from the preset layout template library, the layout border template corresponding to the painting attribute information can be searched from the preset layout template library first, and then the layout border template with the same layout structure as the non-editable text can be obtained from the searched layout border templates.

[0084] For example, if the analysis shows that the painting attribute information corresponding to the painting unit is "comic theme", then the layout border template related to "comic theme" can be searched from the preset layout template library. The layout border template related to "comic theme" can include elements such as simple comic characters and simple comic animals. In addition, the layout border templates related to "comic theme" found can include templates with different layouts such as left-right arrangement templates and top-bottom arrangement templates. If the painting unit and the text paragraph unit in the layout structure of the uneditable text are identified as a top-bottom arrangement structure, the layout border template with a top-bottom arrangement structure can be selected from the layout border templates related to "comic theme" found.

[0085] Furthermore, when executing step S106, the embodiment of the present invention can adjust the size of the layout frame template based on the marked position information of the painting unit and other types of layout units, and set the resized layout frame template to the position of the painting unit and other types of layout units. By adjusting the size of the layout frame template (such as the proportion size, size, etc.), the unit frame template can be made more suitable for the size of the corresponding layout unit.

[0086] Of course, the painting attribute information corresponding to the analyzed painting unit may contain multiple attribute information at the same time. Whether it is matching the unit border template for the layout structure or matching the layout border template, the elements in the border templates of multiple attribute information can be adaptively combined.

[0087] Taking the matching unit border template as an example, assume that the analyzed painting attribute information contains both "pastoral theme" and "watercolor material" attribute information. After selecting the title border templates related to the "pastoral theme" attribute information and the "watercolor material" attribute information respectively, the elements in the unit border templates of the two attribute information of "pastoral theme" and "watercolor material" can also be adaptively combined. For example, if the selected "pastoral theme" related title border template contains the "flower" element, and the selected "watercolor material" related title border template contains the "green grass with watercolor material" element, then the "flower" element and the "green grass with watercolor material" element can be combined to obtain the combined title border template, and the combined title border template can be applied to the title unit.

[0088] In one embodiment of the present invention, the layout recognition model is implemented based on the semantic segmentation network Unet, and the loss function SoftMax is used as the output of the model. In the process of executing the above step S102, the non-editable text containing the painting is first semantically segmented based on the semantic segmentation network Unet to obtain painting units and other categories of layout units. Then, based on the Otsu algorithm (i.e., the Otsu binarization method), the borders of various types of layout units are identified, and the layout structure of the non-editable text is analyzed based on the borders of various types of layout units. In an embodiment of the present invention, after identifying the layout borders of various types of layout units based on the Otsu algorithm, the layout borders can also be fine-tuned to make the fine-tuned layout borders more standard.

[0089] The layout recognition model of the embodiment of the present invention is implemented based on the semantic segmentation network, so the semantic segmentation network Unet can be trained in the process of training the layout recognition model. When training the semantic segmentation network Unet, first obtain the pre-collected sample data containing the position annotation information of the layout unit and the text line. Then, the obtained sample data is semantically segmented based on the semantic segmentation network Unet. Furthermore, the semantic segmentation result of the sample data and the sample data are input into the discriminator network to use the discriminator network to discriminate the difference between the semantic segmentation result of the sample data and the sample data based on the generative adversarial network GAN (Generative Adversarial Networks) structure. Finally, the semantic segmentation network Unet is trained based on the discriminant difference results.

[0090] The embodiment of the present invention draws on the idea of ​​the generative adversarial network GAN to design the discriminator network D-net, and connects the discriminator network D-net with the semantic segmentation network Unet network. The generative adversarial network GAN in this embodiment can specifically adopt DC GAN (Deep Convolutional Generative Adversarial Networks), and the embodiment of the present invention does not limit the specific type of the generative adversarial network.

[0091] by Figure 5 Taking the training process of semantic segmentation network Unet as an example, the training process of semantic segmentation network Unet is introduced.

[0092] First, collect real data (i.e., sample data) containing the position annotation information of layout units and text lines. Then, input the real data into the semantic segmentation network Unet, use the semantic segmentation network Unet to perform semantic segmentation on the real data, and then output the classification result data (i.e., semantic segmentation result) to the discriminator network D-net. The real data is also input into the discriminator network D-net, so that the discriminator network D-net can discriminate the difference between the classification result data and the sample data based on the generative adversarial network structure. Finally, the discriminator network D-net is used to reversely feedback the discriminant difference results to guide the training of the semantic segmentation network Unet.

[0093] The embodiment of the present invention uses sample data that carries the position annotation information of layout units and text lines to train the layout recognition model, so that the layout structure recognition task and the text line positioning task of the layout recognition model can be trained simultaneously, and multiple recognition tasks can share training features, thereby improving the training efficiency of the model. Moreover, the embodiment of the present invention fine-tunes the semantic segmentation network Une based on the classification results of real data according to the discrimination results of the discriminator network D-net, and can also reduce the negative impact of data missing on the model. In addition, the generative adversarial network of the embodiment of the present invention can replace the traditional classification loss function, and train to obtain a structured loss function loss, so that the recognition results of the trained layout recognition model are smoother, the overfitting phenomenon of the layout recognition model is alleviated, and the impact of abnormal data on the model is reduced.

[0094] In one embodiment of the present invention, before training the semantic segmentation network Unet, the activation function and parameters of the semantic segmentation network Unet may be set.

[0095] The embodiment of the present invention can replace the activation function of the semantic segmentation network Unet with the non-saturated activation function LeakyReLU. The replaced non-saturated activation function LeakyReLU can accelerate the convergence speed of the layout recognition model. Moreover, the embodiment of the present invention sets a preset size of convolution template, a preset step value and a preset number of convolution templates for the semantic segmentation network Unet. For example. The size of the convolution template of the semantic segmentation network Unet is set to 4*4, the step value is 2, and the 1024 convolution layers in the original semantic segmentation network Unet are replaced with 512 convolution layers, that is, the number of convolution templates is set to 512 convolution templates.

[0096] In the embodiment of the present invention, when training the semantic segmentation network Unet, the Adam optimizer can be used to train the semantic segmentation network Unet, and the discriminator network D-net can also be trained first, for example, the discriminator network D-net is trained using the SGD optimizer. In addition, for the semantic segmentation network Unet and the discriminator network D-net that need to be trained, the embodiment of the present invention can also set the learning rate of the semantic segmentation network Unet and the discriminator network D-net to 0.0001.

[0097] In the process of training the layout recognition model, in order to timely understand whether the layout recognition model after training is qualified and whether it can accurately perform layout recognition, the embodiment of the present invention can also evaluate the layout recognition model with different indicators. For example, the layout recognition model can be evaluated by accuracy evaluation, recall evaluation and evaluation model (such as F1 evaluation model), and the recognition effect of the layout recognition model can be evaluated by evaluating the accuracy, recall rate and other indicators of the layout recognition model, and then the layout recognition model can be selectively adaptively adjusted according to the evaluation results. Of course, if all indicators in the evaluation results are normal, there is no need to adjust the layout recognition model.

[0098] In one embodiment of the present invention, when analyzing the painting attribute information corresponding to the painting unit based on the content of other types of layout units, a preset layout recognition model can be used to identify the position of the text line contained in the other types of layout units, and the position of the text line can be marked. Then, the text content in each marked text line is identified by the text recognition model, and the painting attribute information corresponding to the painting unit is analyzed based on the text content. The text content contained in the other types of layout units in the embodiment of the present invention can be Chinese content or other language text, such as English, etc., which is not limited by the embodiment of the present invention.

[0099] Optionally, when using a preset layout recognition model to identify the text line position contained in other categories of layout units, first use an image cropping method to crop out other categories of layout units according to the layout structure, and then identify the character borders of each character contained in each layout unit in other categories of layout units based on the Otsu algorithm, and then merge the borders of the characters belonging to the same text line to obtain the text box of each text line, and finally analyze the text line position contained in other categories of layout units based on the text box. When this embodiment identifies the character borders of each character based on the Otsu algorithm, it can first use an image cropping method to crop the layout unit according to the layout structure of the identified text. Then, the character borders of each character in each layout unit are identified based on the Otsu algorithm.

[0100] Therefore, the layout recognition model of the embodiment of the present invention can complete two recognition tasks, one recognition task is to recognize the layout structure of non-editable text, and the other recognition task is to recognize the position of text lines in the layout structure. For text with a complex layout structure, the text layout structure and text content can be recognized without human intervention, which improves the efficiency of text recognition, and the recognized text layout structure can also well restore the layout structure of the original non-editable text. Furthermore, the text recognized by the embodiment of the present invention can facilitate subsequent secondary editing, such as using the recognized text to make e-books, mine book content knowledge, etc.

[0101] In one embodiment of the present invention, in the process of marking at least one type of layout unit and the position of the text line in the layout unit included in the layout structure, a preset marking tool can be used to mark at least one type of layout unit and the position of the text line in the layout unit. For example, the marking tool Performance Evaluation (operable PE tool) can be used to mark the position of the layout unit and the text line to obtain the position data of the text line and the layout unit. Of course, other marking tools can also be used to complete the marking work of the layout unit and the text line position, and the embodiment of the present invention does not specifically limit this.

[0102] The embodiment of the present invention marks the positions of layout units and text lines in the layout units by using different colors to cover and mark layout units of different categories and cover and mark text lines. According to the different colors, it can be known which position belongs to which type of layout unit and which positions contain text lines, so that different layout units and text lines can be easily distinguished. In addition, the embodiment of the present invention can also use text marking to distinguish the contents of different layout units, so that the positions of each layout unit and text line can be clearly understood according to the different text contents.

[0103] In one embodiment of the present invention, when the text content in each marked text line is identified by the text recognition model, the non-editable text is first cropped into multiple character images using an image cropping method according to the different marked text lines, and each character image contains multiple characters. Then the multiple character images are input into the text recognition model in sequence, and the text recognition model is used to identify the text content in each text line. The text recognition model of the embodiment of the present invention can be constructed based on a convolutional neural network VGG (Visual Geometry Group) and a recurrent neural network LSTM, and before using the text recognition model to identify the text content in each marked text line, the fully connected layer of the convolutional neural network VGG of the text recognition model is removed.

[0104] In the process of training the text recognition model in the embodiment of the present invention, image data annotated with text information is first obtained as training data, and the image features of the training data are extracted using the convolutional neural network VGG with the fully connected layer removed. Then, a recurrent neural network is used to recognize the text information of the training data based on the image features. Then, the loss function CTC (Connectionist Temporal Classification) is used to calculate the loss of the recurrent neural network recognition result, and the text recognition model is trained based on the loss calculation result.

[0105] The recurrent neural network of the embodiment of the present invention can adopt a bidirectional LSTM (Long Short Term Memory) network and output text information through the function SoftMax. The embodiment of the present invention adopts the loss function CTC and combines the bidirectional LSTM to recognize the text content. The training data does not need to be aligned, which can effectively solve the problem of sample data alignment when the traditional LSTM recognizes the text content, and is conducive to the text recognition model to learn the text context features (i.e., text sequence features).

[0106] In order to conveniently extract the image features of the training data, the embodiment of the present invention can also uniformly preprocess the training data before using the convolutional neural network with the fully connected layer removed to extract the image features of the training data. The preprocessing here includes graying and resizing the images used as training data, such as uniformly preprocessing the training data into a grayscale image of 32*32 size. Of course, it can also be processed into grayscale images of other sizes, which are not specifically limited here. In addition, the embodiment of the present invention will also construct a text dictionary, such as a dictionary of Chinese characters, English, etc. The size of the dictionary can be determined according to the number of text categories output by the function SoftMax based on the bidirectional LSTM network. After the training data is preprocessed, the text corresponding to the preprocessed training data is transcoded into a binary vector sequence as a label according to the dictionary, so that the text recognition model is trained using the training data and the corresponding label data.

[0107] In addition, the embodiment of the present invention also sets a preset number of output convolutions for the last convolution layer of the convolutional neural network and a preset hidden layer size for the recurrent neural network. For example, the number of output convolutions of the last convolution layer is set to 1024, the hidden layer size of the LSTM network is set to 256, and the last convolution layer is connected to the recurrent neural network.

[0108] In the process of training the text recognition model, in order to timely understand whether the trained text recognition model is qualified and whether it can accurately perform text recognition, the embodiment of the present invention can also evaluate the text recognition model with different indicators. For example, evaluation methods such as accuracy evaluation, recall evaluation and evaluation model (such as F1 evaluation model) can be used to evaluate the recognition effect of the text recognition model by evaluating the accuracy, recall rate and other indicators of the text recognition model. Then, the text recognition model can be selectively adaptively adjusted according to the evaluation results. Of course, if all indicators in the evaluation results are normal, there is no need to adjust the text recognition model.

[0109] After identifying the text content in each text line, the embodiment of the present invention can display the identified text content at the corresponding position of the non-editable text according to the layout unit and the marking position of the text line, so that the identified text also retains the original text structure information, effectively restoring the layout structure of the original text.

[0110] Based on the same inventive concept, an embodiment of the present invention further provides a painting recognition device. Figure 6 FIG. 2 shows a schematic diagram of the structure of a painting recognition device according to an embodiment of the present invention. Figure 6 The painting recognition device includes a recognition module 610 , an analysis module 620 and a display module 630 .

[0111] The recognition module 610 is adapted to obtain the non-editable text including paintings, and use a preset layout recognition model to recognize the layout structure of the non-editable text, where the layout structure includes painting units and other types of layout units.

[0112] The analysis module 620 is adapted to analyze the painting attribute information corresponding to the painting unit according to the content of other types of layout units, and search for a layout template related to the painting attribute information from a preset layout template library.

[0113] The display module 630 is adapted to mark the positions of the painting units and other types of layout units, and combine the painting units and other types of layout units into a layout template based on the marked position information and display them.

[0114] In one embodiment of the present invention, other types of layout units include: at least one of text paragraph units, title units, and table units; and / or painting attribute information includes: at least one of the painting's genre information, subject matter information, material information, and time information.

[0115] In one embodiment of the present invention, the preset layout template library stores unit border templates corresponding to different painting attribute information, and the analysis module 620 is further suitable for searching the preset layout template library for unit border templates corresponding to the painting attribute information; obtaining the painting border template and the unit border templates corresponding to other categories of layout units from the searched unit border templates; wherein the unit border template category includes at least one of a painting border template, a text paragraph border template, a title border template, and a table border template.

[0116] In one embodiment of the present invention, the display module 630 is also suitable for adjusting the sizes of the painting border template and the unit border templates corresponding to other categories of layout units based on the marked position information; and setting the resized unit border templates at the corresponding positions of the painting units and other categories of layout units and displaying them.

[0117] In one embodiment of the present invention, the preset layout template library stores layout border templates with different layout structures corresponding to different painting attribute information, and the analysis module 620 is also suitable for searching the layout border template corresponding to the painting attribute information from the preset layout template library; and obtaining the layout border template with the same layout structure as the non-editable text from the searched layout border templates.

[0118] In one embodiment of the present invention, the display module 630 is also suitable for adjusting the size of the layout border template based on the marked position information of the painting unit and other types of layout units; and setting the resized layout border template corresponding to the position of the painting unit and other types of layout units.

[0119] In one embodiment of the present invention, the recognition module 610 is also suitable for performing semantic segmentation on the uneditable text containing paintings based on a semantic segmentation network to obtain painting units and other types of layout units; identifying the borders of various types of layout units based on the Otsu algorithm, and analyzing the layout structure of the uneditable text based on the borders of various types of layout units.

[0120] See also Figure 7 The painting recognition device of the embodiment of the present invention not only includes Figure 6 The modules shown in also include a first training module 640.

[0121] The first training module 640 is suitable for replacing the activation function of the semantic segmentation network with a non-saturated activation function; setting a convolution template of a preset size, a preset step value and a preset number of convolution templates for the semantic segmentation network; obtaining sample data containing position annotation information of layout units and text lines, and performing semantic segmentation on the sample data based on the semantic segmentation network; inputting the semantic segmentation result of the sample data and the sample data into the discriminator network, and using the discriminator network to discriminate the difference between the semantic segmentation result of the sample data and the sample data based on the generative adversarial network structure; and training the semantic segmentation network according to the discriminant difference result.

[0122] In one embodiment of the present invention, the analysis module 620 is also suitable for using a preset layout recognition model to identify the positions of text lines contained in other categories of layout units, and marking the positions of the text lines; identifying the text content in each marked text line through the text recognition model, and analyzing the painting attribute information corresponding to the painting unit based on the text content.

[0123] In one embodiment of the present invention, the analysis module 620 is also suitable for cropping other categories of layout units using an image cropping method according to the layout structure; identifying the character borders of each character contained in each layout unit in other categories of layout units based on the Otsu algorithm; merging the borders of characters belonging to the same text line to obtain text boxes for each text line; and analyzing the positions of text lines contained in other categories of layout units based on the text boxes.

[0124] In one embodiment of the present invention, the analysis module 620 is further adapted to use a preset marking tool to mark the positions of the painting units and other types of layout units; wherein different layout units are distinguished by using different marking methods.

[0125] See also Figure 8 The painting recognition device of the embodiment of the present invention not only includes Figure 6 The modules shown in also include a second training module 650. In this embodiment, the text recognition model is constructed based on a convolutional neural network and a recurrent neural network.

[0126] The second training module 650 is suitable for obtaining image data annotated with text information as training data; preprocessing the training data uniformly into a grayscale image of a specified size, setting a preset number of output convolutions for the last convolution layer of the convolutional neural network, and setting a preset hidden layer size for the recurrent neural network; extracting image features of the training data using the convolutional neural network with the fully connected layer removed; using the recurrent neural network based on the image features to recognize the text information of the training data; performing loss calculation on the recurrent neural network recognition results based on the loss function, and training the text recognition model according to the loss calculation results.

[0127] Based on the same inventive concept, an embodiment of the present invention further provides a computer storage medium, which stores computer program code. When the computer program code runs on a computing device, the computing device executes the painting recognition method of any of the above embodiments.

[0128] Based on the same inventive concept, an embodiment of the present invention further provides a computing device, including: a processor; a memory storing computer program code; when the computer program code is executed by the processor, the computing device executes the painting recognition method of any of the above embodiments.

[0129] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.

[0130] In addition, the functional units in various embodiments of the present invention may be physically independent of each other, or two or more functional units may be integrated together, or all functional units may be integrated into one processing unit. The above integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.

[0131] Those skilled in the art can understand that if the integrated functional unit is implemented in the form of software and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can essentially or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, which includes a number of instructions to enable a computing device (such as a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention when running the instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.

[0132] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as a computing device such as a personal computer, a server, or a network device), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of a computing device, the computing device executes all or part of the steps of the methods described in the embodiments of the present invention.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present invention, the technical solutions described in the aforementioned embodiments can still be modified, or some or all of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate from the protection scope of the present invention.

Claims

1. A painting recognition method, include: Obtaining non-editable text containing paintings, and using a preset layout recognition model to recognize a layout structure of the non-editable text, wherein the layout structure includes painting units and other types of layout units; Analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units, and searching for a layout template related to the painting attribute information from a preset layout template library; Marking the positions of the painting units and other types of layout units, combining the painting units and other types of layout units into the layout template based on the marked position information and displaying them; The step of analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units and searching for a layout template related to the painting attribute information from a preset layout template library includes: By matching the age information of the painting content with the timeline of the painting border template library, a painting border template that matches the age information of the painting content is found from the preset layout template library, wherein the painting border template library also has painting style branches of different ages on the age timeline.

2. The method according to claim 1, It is characterized in that The other types of layout units include: at least one of a text paragraph unit, a title unit, and a table unit; and / or The painting attribute information includes at least one of the painting's genre information, subject information, material information, and time information.

3. The method according to claim 1 or 2, It is characterized in that The preset layout template library stores unit border templates corresponding to different painting attribute information, and searching the preset layout template library for a layout template related to the painting attribute information includes: Searching for a unit border template corresponding to the painting attribute information from the preset layout template library; Acquire the painting border template and the unit border templates corresponding to the other types of layout units from the found unit border templates; The unit border template category includes at least one of a painting border template, a text paragraph border template, a title border template, and a table border template.

4. The method according to claim 3, It is characterized in that Combining the painting unit and other types of layout units into the layout template based on the marked position information and displaying the same includes: Based on the marked position information, the sizes of the painting frame template and the unit frame templates corresponding to other types of layout units are respectively adjusted; The resized frame templates of each unit are respectively set and displayed at the positions of the painting units and other types of layout units.

5. The method according to claim 1 or 2, It is characterized in that The preset layout template library stores layout frame templates with different layout structures corresponding to different painting attribute information, and searching the preset layout template library for a layout template related to the painting attribute information includes: Searching for a layout frame template corresponding to the painting attribute information from the preset layout template library; A layout frame template having the same layout structure as the layout structure of the non-editable text is obtained from the found layout frame templates.

6. The method according to claim 5, It is characterized in that Combining the painting unit and other types of layout units into the layout template based on the marked position information and displaying the same includes: Adjusting the size of the layout frame template based on the marked position information of the painting unit and other types of layout units; The resized layout frame template is correspondingly set at the positions of the painting units and other types of layout units.

7. The method according to claim 1 or 2, It is characterized in that The layout structure of the non-editable text is identified using a preset layout recognition model, including: Based on the semantic segmentation network, the non-editable text containing paintings is semantically segmented to obtain painting units and other category layout units; The borders of various layout units are identified based on the Otsu algorithm, and the layout structure of the non-editable text is analyzed according to the borders of various layout units.

8. The method according to claim 7, It is characterized in that Before semantic segmentation of non-editable text containing paintings based on the semantic segmentation network, it also includes: Replacing the activation function of the semantic segmentation network with a non-saturated activation function; Setting a convolutional template of a preset size, a preset step value, and a preset number of convolutional templates for the semantic segmentation network; Acquire sample data including position annotation information of layout units and text lines, and perform semantic segmentation on the sample data based on the semantic segmentation network; Inputting the semantic segmentation result of the sample data and the sample data into a discriminator network, and using the discriminator network to discriminate the difference between the semantic segmentation result of the sample data and the sample data based on a generative adversarial network structure; The semantic segmentation network is trained according to the discrimination difference results.

9. The method according to claim 1 or 2, It is characterized in that Analyzing the painting attribute information corresponding to the painting unit according to the content of other types of layout units, including: Using a preset layout recognition model to recognize the position of the text line contained in the other types of layout units, and marking the position of the text line; The text content in each marked text line is identified by a text recognition model, and the painting attribute information corresponding to the painting unit is analyzed according to the text content.

10. The method according to claim 9, It is characterized in that Using a preset layout recognition model to recognize the text line position contained in the other types of layout units includes: Cut out other types of layout units by using image cutting method according to the layout structure; Recognize the character borders of each character contained in each layout unit of other categories of layout units based on the Otsu algorithm; Merge the borders of characters belonging to the same text line to obtain the text frame of each text line; The text line positions contained in the other types of layout units are analyzed based on the text frame.

11. The method according to claim 1 or 2, It is characterized in that The positions of the painting units and other types of layout units are marked, including: Using a preset marking tool to mark the positions of the painting units and other types of layout units; Among them, different layout units are distinguished by different marking methods.

12. The method according to claim 9, It is characterized in that The text recognition model is constructed based on a convolutional neural network and a recurrent neural network. Before the text content in each marked text line is recognized by the text recognition model, the following steps are also included: Obtain image data annotated with text information as training data; Preprocessing the training data uniformly into a grayscale image of a specified size, setting a preset number of output convolutions for the last convolutional layer of the convolutional neural network, and setting a preset hidden layer size for the recurrent neural network; Extracting image features of the training data using a convolutional neural network with a fully connected layer removed; Recognize text information of the training data using a recurrent neural network based on the image features; The loss function is used to calculate the recognition results of the recurrent neural network, and the text recognition model is trained based on the loss calculation results.

13. A painting recognition device, include: A recognition module, adapted to obtain non-editable text containing paintings, and use a preset layout recognition model to recognize a layout structure of the non-editable text, wherein the layout structure includes painting units and other types of layout units; An analysis module, adapted to analyze the painting attribute information corresponding to the painting unit according to the content of other types of layout units, and search for a layout template related to the painting attribute information from a preset layout template library; A display module, adapted to mark the positions of the painting units and other types of layout units, and combine the painting units and other types of layout units into the layout template based on the marked position information for display; Among them, the analysis module is used to match the age information of the painting content with the time axis of the painting border template library, and search for a painting border template that matches the age information of the painting content from the preset layout template library, wherein the painting border template library also has painting style branches of different ages on the age time axis.

14. A computer storage medium storing a computer program code, wherein when the computer program code is executed on a computing device, the computing device is caused to execute the painting recognition method according to any one of claims 1 to 12.

15. A computing device, include: processor; a memory storing computer program code; When the computer program code is executed by the processor, the computing device is caused to execute the painting recognition method according to any one of claims 1 to 12.