Intelligent image and text typesetting method and system based on saliency detection
Through the intelligent graphic typesetting method based on saliency detection, the global semantics and keyword features in the text data are extracted, and combined with the typesetting splicing model and image data, it solves the problem that text recognition technology in the existing technology cannot be applied to various fields. , achieving efficient and accurate results in graphic and text typesetting.
Patent Information
- Application Number
- CN202311679915.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-08
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2043-12-08
AI Technical Summary
Existing text recognition technology can only recognize and typeset text of a single text type or a general field, and cannot be applied to a wider range of fields, resulting in low accuracy and low efficiency in graphic typesetting.
An intelligent image and text typesetting method based on saliency detection is used to preprocess image and text data, and the pre-trained saliency detection model is used to extract global semantic and keyword features, and is combined with the typesetting splicing model for multiple splicing to calculate the typesetting balance. value, combine the pixel feature values in the image data to generate a layout prediction queue, calculate the layout saliency, and obtain the graphic and text layout results.
It achieves accurate identification and typesetting of different types of text data, improves the accuracy and efficiency of picture and text typesetting, reduces the loss of text semantic information, strengthens local details, and meets the identification and typesetting needs of different types of text.
Smart Images

Figure CN117669493B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of text editing, and in particular relates to an intelligent graphic typesetting method and system based on saliency detection. Background Art
[0002] In the field of artificial intelligence and image processing technology, text recognition technology is an important technical means, and it plays a vital role in the daily use of electronic devices by users. In daily life, editors can use text recognition technology to quickly and accurately extract the strokes, contours, characteristic angles and other geometric features of each character in the text. At the same time, text recognition technology can greatly improve text typesetting and editing efficiency. In-depth research and thinking about the development direction and application scenarios of text recognition technology is also of great significance to promoting technological progress.
[0003] Existing text recognition technology can only recognize and typeset text of a single type or general field. How to apply text recognition technology to a wider range of fields and improve the accuracy and efficiency of graphic typesetting has become an urgent problem to be solved. Based on this, we proposed an intelligent graphic typesetting method and system based on saliency detection. Summary of the invention
[0004] The purpose of the present invention is to address the shortcomings of the prior art and provide an intelligent image and text typesetting method and system based on saliency detection, which solves the problem that the existing text recognition technology can only recognize and typeset texts of a single text type or a general field, and cannot be applied to a wider range of fields and improve the accuracy and efficiency of image and text typesetting.
[0005] Existing text recognition technology can only recognize and typeset text of a single text type or a general field. How to apply text recognition technology to a wider range of fields and improve the accuracy and efficiency of image and text typesetting has become an urgent problem to be solved. Based on this, we propose an intelligent image and text typesetting method and system based on saliency detection. In short, the method specifically includes obtaining image and text data, and preprocessing the obtained image and text data, and then performing saliency detection on the text data in the preprocessing set based on a pre-trained saliency detection model, extracting global semantics and keyword features in the text data, and then performing a first splicing on the global semantics and keyword features in the text data based on a pre-trained typesetting splicing model to obtain a first prediction result, performing a second splicing on the global semantics and keyword features based on the pre-trained typesetting splicing model to obtain a second prediction result, calculating the typesetting balance value of the first prediction result and the second prediction result, and taking the prediction result with a high typesetting balance value as the output. At the same time, the pixel feature value in the image data can be determined based on deep learning, a typesetting prediction queue is generated according to the pixel feature value, and the saliency of multiple groups of typesetting layouts in the typesetting prediction queue is calculated to obtain the image and text typesetting result. The embodiment of the present invention performs saliency detection on the text data in the preprocessing set through a pre-trained saliency detection model, so as to effectively extract the global semantics and keyword features in different types of text data, and at the same time combine the typesetting splicing model to predict the text typesetting, calculate and compare the typesetting balance values of different prediction results, so that the typesetting result is more accurate and effective, and at the same time, it can also combine the pixel feature values in the image data to calculate the saliency of multiple groups of typesetting layouts in the typesetting prediction queue to obtain the graphic typesetting result, thereby quickly and accurately generating the graphic typesetting result.
[0006] The present invention is implemented by an intelligent image and text typesetting method based on saliency detection, and the intelligent image and text typesetting method based on saliency detection comprises:
[0007] Acquire graphic data, and preprocess the acquired graphic data to generate a preprocessing set;
[0008] Load the preprocessing set, perform saliency detection on the text data in the preprocessing set based on the pre-trained saliency detection model, and extract global semantics and keyword features from the text data;
[0009] Based on the pre-trained typesetting splicing model, the global semantics and keyword features in the text data are spliced to obtain the first prediction result;
[0010] Load the global semantics and keyword features in the text data, perform secondary splicing on the global semantics and keyword features based on the pre-trained typesetting splicing model, and obtain the second prediction result;
[0011] The layout balance values of the first prediction result and the second prediction result are calculated, and the prediction result with a higher layout balance value is output.
[0012] Preferably, the method further comprises:
[0013] Based on deep learning, pixel feature values in the image data are determined, a layout prediction queue is generated according to the pixel feature values, and the significance of multiple groups of layout formats in the layout prediction queue is calculated to obtain a graphic layout result.
[0014] Preferably, the method for preprocessing the acquired graphic data specifically includes:
[0015] Traversing and parsing the acquired image and text data, separating the image data and the text data based on the image and text filter to form a text data set and an image data set respectively;
[0016] Load the text dataset and normalize it;
[0017] Obtain normalized text data, read the text data based on K-fold cross validation combined with grid search method, and identify characters, punctuation marks, and language categories in the text data.
[0018] Preferably, the method for constructing the saliency detection model specifically includes:
[0019] Obtain standard text data from a pre-established dynamic text database, and divide the standard text data into a training set, a validation set, and a test set;
[0020] Constructing an initial detection model, taking the training set as input, executing the initial detection model, and iterating the training of the initial detection model;
[0021] Wherein, when the initial detection model is trained iteratively, the training set is input into the initial detection model to obtain the first feature output and the second feature output respectively, and the first feature output and the second feature output are fused and outputted to obtain the third feature output, and the detection loss value is calculated by the comparison matrix of the third feature output and the radial basis kernel function, and the radial basis kernel function is used to control the detection accuracy of the initial detection model;
[0022] Load the validation set and validate the initial detection model based on the validation set;
[0023] A test set is obtained, and whether the saliency detection result meets expectations is determined based on the test set. If so, the saliency detection model is constructed. If not, an initial detection model is constructed, and the initial detection model is executed with the training set as input, and the initial detection model is trained iteratively.
[0024] Preferably, the saliency detection model includes a convolution module and a feature detection module, and the output of the convolution module serves as the input of the feature detection module;
[0025] The convolution module includes three stages of convolution, and each stage of convolution includes a convolution layer, a pooling layer, and a fully connected layer;
[0026] The feature detection module includes a feature hidden layer, an attention layer, a classification layer and a weighted output layer. The fully connected layer is connected to the feature hidden layer, and the feature hidden layer is connected to the classification layer and the weighted output layer respectively.
[0027] Preferably, the method for extracting global semantics and keyword features from text data specifically includes:
[0028] The convolution module performs multi-level convolution on the input text data, extracts multiple sets of text features, and obtains the text feature convolution result D k (D1,D2,...,D k-1 ,D k ), where the convolution result D k Denoted as:
[0029]
[0030] Wherein, the M represents the convolution kernel size U×V in the convolution layer, and L is the convolution matrix, and each group of the convolution matrix It has j dimensions, and each dimension contains i characteristic factors;
[0031] Get the convolution result D k , based on the convolution result D k The features are pooled, and then nonlinearly mapped based on the S-transform activation function, and downsampled by taking the maximum value to obtain the feature fully connected output vector C k , wherein the S-transform activation function is expressed by formula (2);
[0032]
[0033] Wherein, the γ is the activation parameter curvature, and the activation parameter curvature varies between 0.8 and 0.85.
[0034] Preferably, the method for extracting global semantics and keyword features from text data further includes:
[0035] The feature hidden layer in the feature detection module hides the fully connected output vector and obtains the feature hidden vector C τ k , determine the feature hidden vector C τ k Whether it is greater than a preset hidden threshold, if it is greater than the preset hidden threshold, the current feature vector is retained, if it is less than the preset hidden threshold, the current feature vector is hidden;
[0036]
[0037] Among them, α and β are the feature hidden vectors C τ k The pre-surrounding scale and post-surrounding scale of the function, and the preset hidden threshold is 0.65, and the β value range is [0.1,1];
[0038] Extract keyword vectors and text classification vectors from feature vectors based on the GloVe word embedding model in the classification layer;
[0039] Load the keyword vector and text classification vector, merge the keyword vector and text classification vector based on the Bi LSTM model in the weighted output layer, and obtain the global semantic features.
[0040] Preferably, the method of performing one-time splicing of global semantics and keyword features in text data based on the pre-trained typesetting splicing model to obtain the first prediction result specifically includes:
[0041] Load global semantics and keyword features, and splice them through the typesetting splicing model to obtain a text dataset with global semantics and keyword features;
[0042] Retrieve the typesetting classification template and mapping relationship corresponding to the global semantics and keyword features in the pre-established dynamic text database;
[0043] Sequentially typeset the text data set based on the typesetting classification template and the mapping relationship to obtain a first prediction result;
[0044] The method for calculating the layout balance value of the first prediction result and the second prediction result specifically includes:
[0045] Parse the sequence typesetting architecture and load the global semantic feature R τ k And sequence typesetting, disassemble the clauses in the sequence typesetting to obtain the clause set F τ k (F τ 1,F τ 2,...,F τ k-1 ,F τ k ), calculate the sentence set F τ k and the global semantic feature R τ k The clause balance value between τ k ;
[0046]
[0047] Among them, p represents the typesetting classification function, and N is the total number of sentences;
[0048]
[0049] Among them, σ represents the number of iterations of the typesetting classification function, a is the number of paragraphs in the current sequence typesetting, and g k To map asymmetric variables, the function expression (6) of the global semantic feature is:
[0050]
[0051] Among them, φ k is the keyword vector, θ represents the text classification vector, and the text classification vector is used for text classification based on the LDA model;
[0052]
[0053] On the other hand, the present invention also provides an intelligent image and text typesetting system based on saliency detection, wherein the intelligent image and text typesetting system based on saliency detection specifically comprises:
[0054] A data preprocessing module, the data preprocessing module is used to obtain graphic data, and preprocess the obtained graphic data to generate a preprocessing set;
[0055] A saliency detection module, which is used to load a preprocessing set, perform saliency detection on the text data in the preprocessing set based on a pre-trained saliency detection model, and extract global semantics and keyword features from the text data;
[0056] A typesetting splicing module, wherein the typesetting splicing module performs a first splicing of global semantics and keyword features in text data based on a pre-trained typesetting splicing model to obtain a first prediction result, loads the global semantics and keyword features in the text data, performs a second splicing of the global semantics and keyword features based on the pre-trained typesetting splicing model to obtain a second prediction result, calculates the typesetting balance value of the first prediction result and the second prediction result, and outputs the prediction result with a higher typesetting balance value;
[0057] A graphic typesetting module, which determines the feature values of pixels in the image data based on deep learning, generates a typesetting prediction queue according to the feature values of pixels, calculates the significance of multiple groups of typesetting formats in the typesetting prediction queue, and obtains a graphic typesetting result.
[0058] Preferably, the data preprocessing module specifically includes:
[0059] An image-text separation unit, the image-text separation unit is used to traverse and parse the acquired image-text data, separate the image data and the text data based on the image-text filter, and form a text data set and an image data set respectively;
[0060] A normalization unit, wherein the normalization unit is used to load a text data set and perform normalization processing on the text data set;
[0061] A text data reading unit is used to obtain normalized text data, read the text data based on K-fold cross validation combined with a grid search method, and identify characters, punctuation marks, and language categories in the text data.
[0062] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0063] The embodiment of the present invention performs saliency detection on the text data in the preprocessing set through a pre-trained saliency detection model, so as to effectively extract the global semantics and keyword features in different types of text data, and at the same time combine the typesetting splicing model to predict the text typesetting, calculate and compare the typesetting balance values of different prediction results, so that the typesetting result is more accurate and effective, and at the same time, it can also combine the pixel feature values in the image data to calculate the saliency of multiple groups of typesetting layouts in the typesetting prediction queue to obtain the graphic typesetting result, thereby quickly and accurately generating the graphic typesetting result.
[0064] In an embodiment of the present invention, a combined saliency detection model based on a convolutional neural network is formed by combining a convolution module with a feature detection module. The saliency detection model segments and extracts text data, reduces the loss of semantic information of small texts and strengthens local details, making global semantics and keyword features more accurate, thereby meeting the recognition and typesetting requirements of different types of texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is a schematic diagram of the implementation process of the intelligent image and text typesetting method based on saliency detection provided by the present invention.
[0066] Figure 2 It is a schematic diagram of the implementation flow of the method for preprocessing acquired graphic and text data provided by the present invention.
[0067] Figure 3 It is a schematic diagram of the implementation process of the saliency detection model construction method provided by the present invention.
[0068] Figure 4 It is a schematic diagram of the implementation flow of the method for extracting global semantics and keyword features from text data provided by the present invention.
[0069] Figure 5It is a schematic diagram of the implementation flow of the method for obtaining a first prediction result by splicing global semantics and keyword features in text data based on a pre-trained typesetting splicing model provided by the present invention.
[0070] Figure 6 It is a schematic diagram of the implementation flow of the method for calculating the typesetting balance value of the first prediction result and the second prediction result provided by the present invention.
[0071] Figure 7 It is a structural schematic diagram of the intelligent image and text typesetting system based on saliency detection provided by the present invention.
[0072] Figure 8 It is a structural schematic diagram of the data preprocessing module provided by the present invention. DETAILED DESCRIPTION
[0073] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0074] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. The recognition and typesetting of text in this application combines artificial intelligence and robot vision technology to achieve target recognition, tracking, measurement and processing.
[0075] Existing text recognition technology can only recognize and typeset text of a single text type or a general field. How to apply text recognition technology to a wider range of fields and improve the accuracy and efficiency of image and text typesetting has become an urgent problem to be solved. Based on this, we propose an intelligent image and text typesetting method and system based on saliency detection. In short, the method specifically includes obtaining image and text data, and preprocessing the obtained image and text data, and then performing saliency detection on the text data in the preprocessing set based on a pre-trained saliency detection model, extracting global semantics and keyword features in the text data, and then performing a first splicing on the global semantics and keyword features in the text data based on a pre-trained typesetting splicing model to obtain a first prediction result, performing a second splicing on the global semantics and keyword features based on the pre-trained typesetting splicing model to obtain a second prediction result, calculating the typesetting balance value of the first prediction result and the second prediction result, and taking the prediction result with a high typesetting balance value as the output. At the same time, the pixel feature value in the image data can be determined based on deep learning, a typesetting prediction queue is generated according to the pixel feature value, and the saliency of multiple groups of typesetting layouts in the typesetting prediction queue is calculated to obtain the image and text typesetting result. The embodiment of the present invention performs saliency detection on the text data in the preprocessing set through a pre-trained saliency detection model, so as to effectively extract the global semantics and keyword features in different types of text data, and at the same time combine the typesetting splicing model to predict the text typesetting, calculate and compare the typesetting balance values of different prediction results, so that the typesetting result is more accurate and effective, and at the same time, it can also combine the pixel feature values in the image data to calculate the saliency of multiple groups of typesetting layouts in the typesetting prediction queue to obtain the graphic typesetting result, thereby quickly and accurately generating the graphic typesetting result.
[0076] The embodiment of the present invention provides an intelligent image and text typesetting method based on saliency detection. Figure 1 The figure shows a schematic diagram of the implementation process of the intelligent image and text typesetting method based on saliency detection. The intelligent image and text typesetting method based on saliency detection specifically includes:
[0077] Step S10, acquiring image and text data, and preprocessing the acquired image and text data to generate a preprocessing set;
[0078] It should be noted that the graphic data described in this embodiment includes but is not limited to text data and image data, and the text data at least includes phrases, sentences, punctuation marks, paragraphs or documents composed of text, and the image data includes but is not limited to images captured by computer equipment, images taken by cameras, and images drawn manually, etc., and the format of the graphic data includes multiple formats, which can be JPEG format, BMP format, GIF format, PNG format, txt format, word format, pdf format, ofd format, etc. The specific manifestation of text data can be a variety of text application scenarios such as programming tutorials with multiple composite characters, legal documents, sentiment analysis, graphic teaching materials, current affairs news, sports events, etc.
[0079] Step S20, loading the preprocessing set, performing saliency detection on the text data in the preprocessing set based on the pre-trained saliency detection model, and extracting global semantics and keyword features in the text data;
[0080] It can be understood that the present application can quickly capture the global semantics and keyword features in the text data by performing saliency detection on the preprocessed concentrated text data through the pre-trained saliency detection model, thereby facilitating the typesetting of the text data and avoiding the problems of chaotic typesetting and large errors caused by unclear global semantics and keywords. At the same time, when the saliency detection model performs saliency detection on the preprocessed concentrated text data, it captures the full-text keywords one by one, which can ensure the accuracy of the capture. At the same time, capturing by keywords can avoid the interference of the original text format on the capture.
[0081] Step S30, splicing the global semantics and keyword features in the text data based on the pre-trained typesetting splicing model to obtain a first prediction result;
[0082] Step S40, loading global semantics and keyword features in the text data, performing secondary splicing on the global semantics and keyword features based on a pre-trained typesetting splicing model, and obtaining a second prediction result;
[0083] Step S50, calculating the layout balance values of the first prediction result and the second prediction result, and outputting the prediction result with a higher layout balance value.
[0084] It is understandable that in order to avoid errors, the pre-trained typesetting splicing model can perform multiple splicing of global semantics and keyword features, thereby avoiding the situation where the typesetting fails to achieve the desired effect due to large typesetting splicing errors.
[0085] Step S60, determining the pixel feature values in the image data based on deep learning, generating a typesetting prediction queue according to the pixel feature values, calculating the significance of multiple groups of typesetting formats in the typesetting prediction queue, and obtaining a graphic typesetting result.
[0086] In this embodiment, feature points of the acquired image data are extracted through deep learning, so as to ensure that when the text data is typeset on the image, it can be intelligently integrated with the image, while avoiding interference of dark pixels on the image with the text, thereby ensuring the typesetting effect and solving the problem that the prior art cannot effectively combine text and images to accurately typeset graphic data.
[0087] In this embodiment, the embodiment of the present invention performs saliency detection on the text data in the preprocessing set through a pre-trained saliency detection model, so that the global semantics and keyword features in different types of text data can be effectively extracted, and the typesetting splicing model is combined to predict the text typesetting, and the typesetting balance values of different prediction results are calculated and compared, so that the typesetting results are more accurate and effective. At the same time, the pixel feature values in the image data can be combined to calculate the saliency of multiple groups of typesetting layouts in the typesetting prediction queue to obtain the graphic typesetting results, thereby quickly and accurately generating graphic typesetting results.
[0088] The embodiment of the present invention provides a method for preprocessing acquired graphic data. Figure 2 The figure shows a schematic diagram of the implementation process of the method for preprocessing the acquired graphic data. The method for preprocessing the acquired graphic data specifically includes:
[0089] Step S101, traversing and parsing the acquired image and text data, separating the image data and the text data based on the image and text filter to form a text data set and an image data set respectively;
[0090] It is understandable that the image and text filter parses and separates image data and text data based on the attention mechanism network. The attention mechanism network structure is relatively simple and relies on artificially acquired text features. Although the model parameters are relatively small, it can often perform well in complex tasks and has good domain adaptability.
[0091] Step S102, loading a text data set and performing normalization processing on the text data set;
[0092] It is understandable that the purpose of normalizing text data is to facilitate data processing and map the target data to a range of 0-1, so that the result of saliency detection is smoother and conducive to convergence to the optimal solution.
[0093] Step S103, obtaining normalized text data, reading the text data based on K-fold cross validation combined with a grid search method, and identifying characters, punctuation marks, and language categories in the text data.
[0094] In this embodiment, the punctuation mark may be any one of a period, an exclamation mark, a question mark, and an ellipsis.
[0095] In this embodiment, the acquired data is preprocessed to facilitate the extraction of feature points in text data and image data, and thus to normalize the data in order to reduce the load of the system. The data preprocessing method of this application is different from the existing data preprocessing method. It can not only maintain the layout format of the original text data, but also read the text data based on K-fold cross-validation combined with the grid search method, so as to randomly extract the full-text characters in the text data. Multiple random extractions can reduce information loss and form a representation of the entire text data, thereby assisting the saliency detection model in extracting and interpreting features of the text data.
[0096] The embodiment of the present invention provides a method for constructing a saliency detection model. Figure 3 The schematic diagram of the implementation process of the saliency detection model construction method is shown. The saliency detection model construction method specifically includes:
[0097] Step S201, obtaining standard text data in a pre-established dynamic text database, and dividing the standard text data into a training set, a validation set, and a test set.
[0098] It should be noted that the distribution ratio of the training set, validation set and test set can be 40%, 40% and 20% respectively. When building the model, by setting the test set and validation set, the validation set is used to verify and adjust the hyperparameters of the initial detection model, while the test set does not participate in the construction of the initial detection model, so as to better evaluate the performance of the initial detection model.
[0099] In this embodiment, the dynamic text database stores standard text data, and the standard text data contains the full text of the standard text, a typesetting classification template, a text mapping relationship, and a text classification label, wherein the standard text data contains six types of text classification labels, namely, a title segment label, a time period label, a text field label, an emotional segment label, an associated person label, and a keyword label, and the dynamic text database in this application can be constructed, updated, replaced, and deleted, and the dynamic text database in this application includes a Bi LSTM classification model, a GloVe word embedding model, and an LDA model. For example, the input "Metaverse is a collection of virtual time and space, consisting of a series of augmented reality (AR), virtual reality (VR), and the Internet (I nternet)", the Bi LSTM classification model captures "Metaverse", "Virtual Reality" and "Internet" in the input text, the Bi LSTM classification model sorts the text classification label weights, and then combines the GloVe word embedding model to convert the keywords into keyword vectors, and then splices the feature vectors of the global semantics and the keyword vectors, and inputs them into the LDA model to obtain the final classification and database update.
[0100] Step S202, constructing an initial detection model, taking the training set as input, executing the initial detection model, and iterating the training of the initial detection model;
[0101] Wherein, when the initial detection model is trained iteratively, the training set is input into the initial detection model to obtain the first feature output and the second feature output respectively, and the first feature output and the second feature output are fused and outputted to obtain the third feature output, and the detection loss value is calculated by the comparison matrix of the third feature output and the radial basis kernel function, and the radial basis kernel function is used to control the detection accuracy of the initial detection model;
[0102] Step S203, loading a verification set, and verifying the initial detection model based on the verification set;
[0103] In this embodiment, the initial detection model can be verified based on the verification set by using a three-fold cross-validation method, and the samples obtained from the verification set can be all samples except the test set, and the verification scores of the first fold, the second fold, and the third fold are obtained, and then the initial detection model is verified by calculating the average values of the first fold, the second fold, and the third fold.
[0104] Step S204: obtaining a test set, and judging whether the saliency detection result meets expectations based on the test set.
[0105] Step S205: if the conditions are met, the saliency detection model is constructed; if the conditions are not met, an initial detection model is constructed, the training set is used as input, the initial detection model is executed, and the initial detection model is trained iteratively.
[0106] In this embodiment, the saliency detection model includes a convolution module and a feature detection module, and the output of the convolution module serves as the input of the feature detection module;
[0107] The convolution module includes three stages of convolution, and each stage of convolution includes a convolution layer, a pooling layer, and a fully connected layer;
[0108] The three-stage convolution includes a first-stage convolution, a second-stage convolution and a third-stage convolution. The three-stage convolution can be used to comprehensively extract the features of the input text data.
[0109] The first convolution consists of two convolutional layers, and each layer has 64 convolution kernels M;
[0110] The second convolution consists of two convolutional layers, and each layer has 128 convolution kernels M;
[0111] The third convolution consists of three convolutional layers, and each layer has 256 convolution kernels M.
[0112] The feature detection module includes a feature hidden layer, an attention layer, a classification layer and a weighted output layer. The fully connected layer is connected to the feature hidden layer, and the feature hidden layer is connected to the classification layer and the weighted output layer respectively.
[0113] The embodiment of the present invention provides a method for extracting global semantics and keyword features from text data. Figure 4 The schematic diagram of the implementation flow of the method for extracting global semantics and keyword features from text data is shown. The method for extracting global semantics and keyword features from text data specifically includes:
[0114] Step S301: The convolution module performs multi-level convolution on the input text data to extract multiple sets of text features and obtain the text feature convolution result D. k (D1,D2,...,D k-1 ,D k ), where the convolution result D k Denoted as:
[0115]
[0116] Wherein, the M represents the convolution kernel size U×V in the convolution layer, and L is the convolution matrix, and each group of the convolution matrix It has j dimensions, and each dimension contains i characteristic factors;
[0117] Step S302, obtain the convolution result D k , based on the convolution result D k The features are pooled, and then nonlinearly mapped based on the S-transform activation function, and downsampled by taking the maximum value to obtain the feature fully connected output vector C k , wherein the S-transform activation function is expressed by formula (2);
[0118]
[0119] Wherein, the γ is the activation parameter curvature, and the activation parameter curvature varies between 0.8 and 0.85.
[0120] Step S303: The feature hidden layer in the feature detection module performs feature hiding on the fully connected output vector to obtain a feature hidden vector C τ k ;
[0121] It should be noted that, considering that there are multiple sets of repeated feature vectors in the text data, in order to improve the processing efficiency of the feature detection module, the feature of the fully connected output vector is hidden through the feature hiding layer.
[0122] Step S304, determine the feature hidden vector C τk Whether it is greater than a preset hidden threshold, if it is greater than the preset hidden threshold, the current feature vector is retained, if it is less than the preset hidden threshold, the current feature vector is hidden;
[0123]
[0124] Among them, α and β are the feature hidden vectors C τ k The pre-surround scale and post-surround scale of the function, α can be 0.2, β can be 0.5, and the preset hidden threshold is 0.65, and the β value range is [0.1,1];
[0125] Step S305, extracting keyword vectors and text classification vectors in the feature vector based on the GloVe word embedding model in the classification layer;
[0126] In this embodiment, the function expression (6) of the global semantic feature is:
[0127]
[0128] Among them, φ k is the keyword vector, θ represents the text classification vector, and the text classification vector is used for text classification based on the LDA model;
[0129]
[0130] Step S306, loading the keyword vector and the text classification vector, merging the keyword vector and the text classification vector based on the Bi LSTM model in the weighted output layer, and obtaining the global semantic feature.
[0131] In an embodiment of the present invention, a combined saliency detection model based on a convolutional neural network is formed by combining a convolution module with a feature detection module. The saliency detection model segments and extracts text data, reduces the loss of semantic information of small texts and strengthens local details, making global semantics and keyword features more accurate, thereby meeting the recognition and typesetting requirements of different types of texts.
[0132] The embodiment of the present invention provides a method for performing one-time splicing of global semantics and keyword features in text data based on a pre-trained typesetting splicing model to obtain a first prediction result. Figure 5 The present invention shows a schematic diagram of the implementation flow of the method for obtaining a first prediction result by splicing the global semantics and keyword features in the text data based on the pre-trained typesetting splicing model. The method for obtaining a first prediction result by splicing the global semantics and keyword features in the text data based on the pre-trained typesetting splicing model specifically includes:
[0133] Step S401, loading global semantics and keyword features, splicing the global semantics and keyword features through a typesetting splicing model, and obtaining a text dataset with global semantics and keyword features;
[0134] Step S402, retrieve the typesetting classification template and mapping relationship corresponding to the global semantics and keyword features in the pre-established dynamic text database;
[0135] Step S403: sequentially typeset the text data set based on the typesetting classification template and the mapping relationship to obtain a first prediction result.
[0136] In this embodiment, the acquisition of the second prediction result is the same as the first prediction result, except that the typesetting splicing model is a semantic segmentation network model based on deep learning, and the semantic segmentation network model includes a Segnet network and a fully convolutional neural network, and the Segnet network and the fully convolutional neural network both include a decoder, an encoder and a typesetting classifier. When the first prediction result is calculated, the encoder in the Segnet network classifies the typesetting classification templates and mapping relationships in the text data set to obtain the first prediction result. When the second prediction result is calculated, the encoder in the fully convolutional neural network classifies the typesetting classification templates and mapping relationships in the text data set to obtain the second prediction result.
[0137] This application classifies the typesetting classification templates and mapping relationships in the text dataset through the Segnet network and the fully convolutional neural network in the typesetting splicing model, and can randomly generate prediction results with a high degree of balance, thereby ensuring the effect of text typesetting.
[0138] The embodiment of the present invention provides a method for calculating the layout balance value of the first prediction result and the second prediction result. Figure 6 A schematic diagram of an implementation flow of a method for calculating the typesetting balance value of the first prediction result and the second prediction result is shown. The method for calculating the typesetting balance value of the first prediction result and the second prediction result specifically includes:
[0139] Step S501, parsing the sequence typesetting structure;
[0140] Step S502: Load the global semantic feature R τ k And sequence typesetting, disassemble the clauses in the sequence typesetting to obtain the clause set F τ k (F τ 1,F τ 2,...,F τ k-1 ,F τ k );
[0141] Step S503, calculate the sentence set F τ k and the global semantic feature R τ k The clause balance value between τ k ;
[0142]
[0143] Among them, p represents the typesetting classification function, and N is the total number of sentences;
[0144]
[0145] Among them, σ represents the number of iterations of the typesetting classification function, a is the number of paragraphs in the current sequence typesetting, and g k To map asymmetric variables, the function expression (6) of the global semantic feature is:
[0146]
[0147] Among them, φ k is the keyword vector, θ represents the text classification vector, and the text classification vector is used for text classification based on the LDA model;
[0148]
[0149] In this embodiment, by calculating the sentence balance value X of the first prediction result, the second prediction result, the third prediction result and the nth prediction result τ k By arranging the prediction results from high to low to form a prediction result queue, the better prediction result can be selected, and the layout prediction queue generated according to the pixel feature value can be combined to form the graphic layout result.
[0150] It should be noted that the typesetting prediction queue feature value is generated according to the pixel feature value, and the significance of multiple groups of typesetting layouts in the typesetting prediction queue can also be calculated by the typesetting splicing model. The pixel feature extraction refers to the significance detection model extraction method described above.
[0151] The embodiment of the present invention provides an intelligent image and text typesetting system based on saliency detection. Figure 7 The structure diagram of the intelligent image and text typesetting system based on saliency detection is shown. The intelligent image and text typesetting system based on saliency detection specifically includes:
[0152] The data preprocessing module 100 is used to obtain graphic data and preprocess the obtained graphic data to generate a preprocessing set;
[0153] A saliency detection module 200, which is used to load a preprocessing set, perform saliency detection on the text data in the preprocessing set based on a pre-trained saliency detection model, and extract global semantics and keyword features from the text data;
[0154] A typesetting splicing module 300, wherein the typesetting splicing module 300 performs a first splicing of global semantics and keyword features in text data based on a pre-trained typesetting splicing model to obtain a first prediction result, loads the global semantics and keyword features in the text data, performs a second splicing of the global semantics and keyword features based on the pre-trained typesetting splicing model to obtain a second prediction result, calculates the typesetting balance values of the first prediction result and the second prediction result, and outputs the prediction result with a higher typesetting balance value;
[0155] The graphic typesetting module 400 determines the feature values of pixels in the image data based on deep learning, generates a typesetting prediction queue according to the feature values of pixels, calculates the significance of multiple groups of typesetting formats in the typesetting prediction queue, and obtains a graphic typesetting result.
[0156] The embodiment of the present invention performs saliency detection on the text data in the preprocessing set through a pre-trained saliency detection model, so as to effectively extract the global semantics and keyword features in different types of text data, and at the same time combine the typesetting splicing model to predict the text typesetting, calculate and compare the typesetting balance values of different prediction results, so that the typesetting result is more accurate and effective, and at the same time, it can also combine the pixel feature values in the image data to calculate the saliency of multiple groups of typesetting layouts in the typesetting prediction queue to obtain the graphic typesetting result, thereby quickly and accurately generating the graphic typesetting result.
[0157] The embodiment of the present invention provides a data preprocessing module 100, Figure 8 The structure diagram of the data preprocessing module 100 is shown. The data preprocessing module 100 specifically includes:
[0158] An image-text separation unit 110, the image-text separation unit 110 is used to traverse and parse the acquired image-text data, and separate the image data and the text data based on an image-text filter to form a text data set and an image data set respectively;
[0159] A normalization unit 120, wherein the normalization unit 120 is used to load a text data set and perform normalization processing on the text data set;
[0160] The text data reading unit 130 is used to obtain normalized text data, read the text data based on K-fold cross validation combined with a grid search method, and identify characters, punctuation marks, and language categories in the text data.
[0161] In this embodiment, the acquired data is preprocessed to facilitate the extraction of feature points in text data and image data, and thus to normalize the data in order to reduce the load of the system. The data preprocessing method of this application is different from the existing data preprocessing method. It can not only maintain the layout format of the original text data, but also read the text data based on K-fold cross-validation combined with the grid search method, so as to randomly extract the full-text characters in the text data. Multiple random extractions can reduce information loss and form a representation of the entire text data, thereby assisting the saliency detection model in extracting and interpreting features of the text data.
[0162] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, which stores computer program instructions, and the computer program instructions can be executed by a processor. When the computer program instructions are executed, the method of any one of the above embodiments is implemented.
[0163] The computer-readable storage medium (e.g., memory) herein can be a volatile memory or a nonvolatile memory, or can include both a volatile memory and a nonvolatile memory. As an example and not by way of limitation, a nonvolatile memory can include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. A volatile memory can include a random access memory (RAM), which can act as an external cache memory. As an example and not by way of limitation, RAM can be obtained in a variety of forms, such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The storage device of the disclosed aspects is intended to include, but is not limited to, these and other suitable types of memories.
[0164] On the other hand, an embodiment of the present invention further provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the method of any one of the above embodiments is implemented.
[0165] As a non-volatile computer-readable storage medium, the memory can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as the program instructions / modules corresponding to the intelligent graphic typesetting method based on saliency detection in the embodiment of the present application. The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the use of the resource monitoring method, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0166] The processor executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory, that is, realizes the intelligent graphic typesetting method based on saliency detection of the above method embodiment.
[0167] In summary, the present invention provides an intelligent image and text typesetting method based on saliency detection. The embodiment of the present invention performs saliency detection on the text data in the preprocessing set through a pre-trained saliency detection model, so that the global semantics and keyword features in different types of text data can be effectively extracted. At the same time, the typesetting splicing model is combined to predict the text typesetting, and the typesetting balance values of different prediction results are calculated and compared, so that the typesetting results are more accurate and effective. At the same time, the pixel feature values in the image data can be combined to calculate the saliency of multiple groups of typesetting layouts in the typesetting prediction queue to obtain the image and text typesetting results, thereby quickly and accurately generating image and text typesetting results.
[0168] It should be noted that, for the above-mentioned embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described order of actions, because according to the present invention, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0169] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be in the form of telecommunication or other forms.
[0170] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the scope of protection of the invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on these embodiments, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in this field can still combine, add, delete or make other adjustments to the features in the various embodiments of the present invention according to the circumstances without conflict, without making creative work, so as to obtain different other technical solutions that do not deviate from the concept of the present invention in essence, and these technical solutions also belong to the scope of protection of the present invention.
Claims
1. An intelligent graphic typesetting method based on saliency detection, characterized in that: The intelligent graphic typesetting method based on saliency detection includes: Acquire graphic data, and preprocess the acquired graphic data to generate a preprocessing set; Load the preprocessing set, perform saliency detection on the text data in the preprocessing set based on the pre-trained saliency detection model, and extract global semantics and keyword features from the text data; Based on the pre-trained typesetting splicing model, the global semantics and keyword features in the text data are spliced to obtain the first prediction result; Load the global semantics and keyword features in the text data, perform secondary splicing on the global semantics and keyword features based on the pre-trained typesetting splicing model, and obtain the second prediction result; Calculating the layout balance values of the first prediction result and the second prediction result, and outputting the prediction result with the higher layout balance value; Determine pixel feature values in image data based on deep learning, generate a typesetting prediction queue according to the pixel feature values, calculate the significance of multiple typeset layouts in the typesetting prediction queue, and obtain a graphic typesetting result; The method for extracting global semantics and keyword features from text data specifically includes: The convolution module performs multi-level convolution on the input text data, extracts multiple sets of text features, and obtains the text feature convolution results. , where the convolution result Denoted as: (1) Wherein, Represents the convolution kernel in the convolution layer, and the convolution kernel size is ,and is the convolution matrix, and each group of the convolution matrix have dimensions, and each dimension contains characteristic factors; Get the convolution result , based on the convolution result The features are pooled, and then nonlinearly mapped based on the S-transform activation function, and downsampled by taking the maximum value to obtain the feature fully connected output vector , wherein the S-transform activation function is expressed by formula (2); (2) Wherein, is the activation parameter curvature, and the activation parameter curvature varies between 0.8 and 0.85; The feature hidden layer in the feature detection module hides the fully connected output vector and obtains the feature hidden vector , determine the feature hidden vector Whether it is greater than a preset hidden threshold, if it is greater than the preset hidden threshold, the current feature vector is retained, if it is less than the preset hidden threshold, the current feature vector is hidden; (3) Among them, They are the feature hidden vectors The pre-surround scale and post-surround scale of the function, and the preset hidden threshold is 0.65, The value range is ; Extract keyword vectors and text classification vectors from feature vectors based on the GloVe word embedding model in the classification layer; Load keyword vectors and text classification vectors, merge keyword vectors and text classification vectors based on the BiLSTM model in the weighted output layer, and obtain global semantic features; The method of obtaining a first prediction result by splicing global semantics and keyword features in text data based on a pre-trained typesetting splicing model specifically includes: Load global semantics and keyword features, and splice them through the typesetting splicing model to obtain a text dataset with global semantics and keyword features; Retrieve the typesetting classification template and mapping relationship corresponding to the global semantics and keyword features in the pre-established dynamic text database; Sequentially typeset the text data set based on the typesetting classification template and the mapping relationship to obtain a first prediction result; The method for calculating the layout balance value of the first prediction result and the second prediction result specifically includes: Parse the sequence layout architecture and load global semantic features And sequence typesetting, disassemble the sentences in the sequence typesetting to obtain the sentence set , calculate the sentence set With global semantic features The balance value between clauses ; (4) Among them, represents the typesetting classification function, is the total number of clauses; (5) Among them, Indicates the number of iterations of the typesetting classification function, is the number of paragraphs in the current sequence typesetting, To map asymmetric variables, the function expression (6) of the global semantic feature is: (6) Among them, is the keyword vector, Represents a text classification vector, and the text classification vector is based on the LDA model for text classification; (7)。 2. The intelligent image and text typesetting method based on saliency detection according to claim 1, characterized in that: The method for preprocessing the acquired graphic data specifically includes: Traversing and parsing the acquired image and text data, separating the image data and the text data based on the image and text filter to form a text data set and an image data set respectively; Load the text dataset and normalize it; Obtain normalized text data, read the text data based on K-fold cross validation combined with grid search method, and identify characters, punctuation marks, and language categories in the text data.
3. The intelligent graphic typesetting method based on saliency detection according to claim 2, characterized in that: The method for constructing the saliency detection model specifically includes: Obtain standard text data from a pre-established dynamic text database, and divide the standard text data into a training set, a validation set, and a test set; Constructing an initial detection model, taking the training set as input, executing the initial detection model, and iterating the training of the initial detection model; Wherein, when the initial detection model is trained iteratively, the training set is input into the initial detection model to obtain the first feature output and the second feature output respectively, and the first feature output and the second feature output are fused and outputted to obtain the third feature output, and the detection loss value is calculated by the comparison matrix of the third feature output and the radial basis kernel function, and the radial basis kernel function is used to control the detection accuracy of the initial detection model; Load the validation set and validate the initial detection model based on the validation set; A test set is obtained, and whether the saliency detection result meets expectations is determined based on the test set. If so, the saliency detection model is constructed. If not, an initial detection model is constructed, and the initial detection model is executed with the training set as input, and the initial detection model is trained iteratively.
4. The intelligent graphic typesetting method based on saliency detection according to claim 3, characterized in that: The saliency detection model includes a convolution module and a feature detection module, and the output of the convolution module serves as the input of the feature detection module; The convolution module includes three stages of convolution, and each stage of convolution includes a convolution layer, a pooling layer, and a fully connected layer; The feature detection module includes a feature hidden layer, an attention layer, a classification layer and a weighted output layer. The fully connected layer is connected to the feature hidden layer, and the feature hidden layer is connected to the classification layer and the weighted output layer respectively.
5. An intelligent image and text typesetting system based on saliency detection based on the intelligent image and text typesetting method based on saliency detection according to any one of claims 1 to 4, characterized in that: The intelligent graphic typesetting system based on saliency detection specifically includes: A data preprocessing module, the data preprocessing module is used to obtain graphic data, and preprocess the obtained graphic data to generate a preprocessing set; A saliency detection module, which is used to load a preprocessing set, perform saliency detection on the text data in the preprocessing set based on a pre-trained saliency detection model, and extract global semantics and keyword features from the text data; A typesetting splicing module, wherein the typesetting splicing module performs a first splicing of global semantics and keyword features in text data based on a pre-trained typesetting splicing model to obtain a first prediction result, loads the global semantics and keyword features in the text data, performs a second splicing of the global semantics and keyword features based on the pre-trained typesetting splicing model to obtain a second prediction result, calculates the typesetting balance value of the first prediction result and the second prediction result, and outputs the prediction result with a higher typesetting balance value; A graphic typesetting module, which determines the feature values of pixels in image data based on deep learning, generates a typesetting prediction queue according to the feature values of pixels, calculates the significance of multiple groups of typesetting formats in the typesetting prediction queue, and obtains a graphic typesetting result.
6. The intelligent graphic typesetting system based on saliency detection according to claim 5, characterized in that: The data preprocessing module specifically includes: An image-text separation unit, the image-text separation unit is used to traverse and parse the acquired image-text data, separate the image data and the text data based on the image-text filter, and form a text data set and an image data set respectively; A normalization unit, wherein the normalization unit is used to load a text data set and perform normalization processing on the text data set; A text data reading unit is used to obtain normalized text data, read the text data based on K-fold cross validation combined with a grid search method, and identify characters, punctuation marks, and language categories in the text data.
