A scene text detection and recognition method based on cross-modal large language model

Through the image-text encoding and decoding mechanism of the cross-modal large language model and the fine-tuning of the large-scale pre-training model, the problem of detection and recognition task dependence and low efficiency in scene text detection and recognition is solved, and multi-directional and multi-lingual Accurate detection and recognition of text, suitable for complex scene understanding and autonomous driving.

CN117851883BActive Publication Date: 2024-08-30ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410006211.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2024-08-30
Estimated Expiration
2044-01-03

AI Technical Summary

Technical Problem

Existing scene text detection and recognition methods have problems such as strong dependence on detection and recognition tasks, low efficiency, and high noise, especially in the recognition of multi-directional, multi-lingual, curved or irregular text.

Method used

Using a cross-modal large language model, the image-text cross-modal encoding and decoding mechanism is used to simultaneously understand the text position and content, and top-down word-level recognition is achieved through task-oriented fine-tuning of the large-scale pre-training model.

Benefits of technology

It realizes a simplified process of text detection and recognition, improves recognition efficiency, reduces noise, and can accurately detect and identify multi-directional and multi-lingual text content. It is suitable for applications such as scene understanding and autonomous driving.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117851883B
    Figure CN117851883B
Patent Text Reader

Abstract

The present invention discloses a scene text detection and recognition method based on a cross-modal large language model, the method comprising: obtaining multiple groups of image-text data sets with true value annotations; using an image encoder to extract and learn features of images in the data set to obtain feature embedding of the image modality; fusing the image modality feature embedding with the text feature embedding of the corresponding true value annotation to construct a multimodal feature sequence of image and natural language; inputting the fused multimodal feature sequence into the large language model for cross-modal encoding and decoding, and then fine-tuning the network under the autoregressive mechanism; inputting the text image into the above-mentioned trained image encoder and the large language model, and translating the network output into the content and position of the text target contained in the current picture by linear classification and category lookup, thereby completing the text detection and recognition task. The implementation method of the present invention is simple, flexible and robust, and has a wide range of applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision and relates to a scene text detection and recognition method based on a cross-modal large language model. Background Art

[0002] Scene text detection and recognition is defined as the following problem: discovering the location of multi-directional, multi-lingual, curved or irregular text regions in natural scene images and identifying the text content. Due to the effectiveness of statistical modeling, learning-based methods are gradually being applied to scene text detection and recognition tasks. Existing learning-based methods mainly use a deep learning framework to input an image and output the detected text location and its text content in a two-stage manner.

[0003] In recent years, scene text detection and recognition tasks have been widely used in computer vision fields such as scene understanding and image retrieval. There are two key points in scene text detection and recognition tasks: the first is how to break the dependence of the recognition task on the detection task, and use a unified model to simultaneously detect and recognize text in a one-stage manner to simplify the task process; the second is how to achieve a language-level upper-level understanding of the text target in the recognition subtask to solve the problems of excessive noise and low recognition efficiency in character-level recognition. Summary of the invention

[0004] In order to solve the above technical problems existing in the prior art, the present invention proposes a scene text detection and recognition method and device based on a cross-modal large language model. With respect to the first point above, the present invention believes that the image-text cross-modal encoding and decoding mechanism can be used to effectively align image features with text features, thereby obtaining features with both visual and language knowledge, and realizing synchronous understanding of text position and text content; with respect to the second point, the present invention believes that the large language model that has been pre-trained on a large scale has strong language prior knowledge, and task-oriented network fine-tuning of the large language model can realize top-down word-level text recognition. The specific technical solution is as follows:

[0005] The first aspect of the present invention is a scene text detection and recognition method based on a cross-modal large language model, comprising the following steps:

[0006] (1) Obtain several sets of existing image-text datasets with true value annotations for training scene text detection;

[0007] (2) Use the image encoder to extract and learn features from the images in the dataset to obtain feature embedding of the image modality;

[0008] (3) The obtained image modality feature embedding is fused with the corresponding truth-valued annotated text embedding to construct a multimodal feature sequence of image and natural language;

[0009] (4) Inputting the multimodal feature sequence obtained in step (3) into the large language model for cross-modal encoding and decoding, and fine-tuning the network under the autoregressive mechanism based on the initialization model parameters of the large-scale pre-training;

[0010] (5) During detection, the text image is input into the trained image encoder and large language model, and the network output is translated into the content and position of the text target contained in the current image through linear classification and category lookup.

[0011] Furthermore, the step (2) specifically includes the following sub-steps:

[0012] (2.1) Use the backbone network to extract deep features of each image;

[0013] (2.2) The multi-head attention mechanism is used to extract and fuse the deep feature map to obtain the feature embedding of the image modality, that is, the image feature vector sequence X = [x1, x2, ..., x N ].

[0014] Furthermore, the step (3) specifically includes the following sub-steps:

[0015] (3.1) Use the image feature vector sequence obtained in step (2) and the true value annotation of the text target content and its center point coordinates to construct the text input. The text input template is “The texts in the image<image_features> are:instance_1[center_x 1 ,center_y 1 ];instance_2[center_x 2 ,center_y 2 ];...;instance_K[cen ter_x K ,center_y K ];"in<image_features> Corresponding image feature sequence X = [x1, x2, ..., x N ], instance_K represents the text content of the Kth text target contained in the image, center_x K and center_y K Represents the center point position coordinates of the text target;

[0016] (3.2) Use the dictionary to convert the text part in the text input template into the corresponding feature vector, T = [t1, t2, ..., t j ,t L ], "The" corresponds to t1, "texts" corresponds to t2, and the text of instance1 corresponds to t j , coordinate center_y K The value of t L-2 ";" corresponds to t L , thereby combining the image modality feature sequence X to construct a multimodal feature sequence of image and natural language: [t0, t1, t2, ..., x1, x2, ..., x N ,...,t j ,...,t L ,t L+1 ], where t0 represents the start symbol [BOS], t L+1 represents the termination symbol [EOS], and L+N=M; the fused multimodal sequence is concisely represented as Y=[y0,y1,...,y M+1 ].

[0017] Furthermore, the step (4) is specifically as follows:

[0018] (4.1) All instance texts and coordinates in the second half of the multimodal sequence Y after fusion in step (3), i.e. [y q ,...,y M+1 ], as the learning goal of the model;

[0019] (4.2) Use a large-scale pre-trained model to initialize parameters and use the autoregressive mechanism to train the model;

[0020] (4.2) The autoregressive mechanism predicts the learning targets in the sequence one by one.

[0021] Furthermore, the step (4.2) is specifically as follows: q When the model is based on the given sequence y0 to y q-1 There are q feature sequences to predict; when predicting the target y q+1 When y0 to y q There are q+1 feature sequences to predict; and so on, from y q to y M+1 The model is trained by predicting each one and calculating the loss with the true value.

[0022] Specifically, from y q to y M+1The model is trained by predicting each one and calculating the loss with the true value. The loss is calculated using the loss function of the language model, which is expressed as:

[0023]

[0024] Among them, CE(·) is the cross entropy loss function.

[0025] Furthermore, the step (5) is specifically as follows:

[0026] During detection, we first extract features from a given input image to obtain a feature vector sequence X, and then compare it with the text input template “The texts in the image<image_features> are:"The feature sequence [y0,y1,...,y q-1 ] is input into the language model, and the model uses the autoregressive mechanism to predict y one by one q to y M+1 , and then converted into the ID category corresponding to the text or number through the linear classification layer, and finally the specific text or coordinate number is obtained by looking up the table according to the category, that is, "instance_1[center_x 1 ,center_y 1 ];instance_2[center_x 2 ,center_y 2 ];...;instance_K[c enter_x K ,center_y K ];", thereby completing the task of text detection and recognition.

[0027] The second aspect of the present invention is a scene text detection and recognition device based on a cross-modal large language model, the device comprising the following modules:

[0028] Obtaining dataset module: Obtaining several sets of existing image-text datasets with true value annotations for training scene text detection;

[0029] Feature extraction module: Use the image encoder to extract and learn features of images in the dataset to obtain feature embedding of the image modality;

[0030] Fusion construction module: fuses the acquired image modality feature embedding with the corresponding truth-value annotated text embedding to construct a multimodal feature sequence of image and natural language;

[0031] Fine-tuning network module: The multimodal feature sequence obtained by the fusion construction module is input into the large language model for cross-modal encoding and decoding, and the network is fine-tuned under the autoregressive mechanism based on the initialization model parameters of large-scale pre-training;

[0032] Detection module: During detection, the text image is input into the trained image encoder and large language model mentioned above, and the network output is translated into the content and location of the text target contained in the current image through linear classification and category lookup.

[0033] The third aspect of the present invention: an electronic device, comprising one or more processors, for implementing the scene text detection and recognition method based on a cross-modal large language model.

[0034] The fourth aspect of the present invention: a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps of the scene text detection and recognition method based on a cross-modal large language model.

[0035] Compared with the existing scene text detection and recognition methods, the present invention has the following beneficial effects:

[0036] First, the scene text detection and recognition method of the present invention aligns the text image features with the text features through cross-modal encoding and decoding, so that the model can perform detection tasks and recognition tasks at the same time. Moreover, since the recognition task no longer depends on the precise positioning of the polygonal text area, the method can use the coordinates of a single center point to indicate the text position, thus simplifying the form and process of the traditional two-stage text detection and recognition.

[0037] Secondly, the present invention uses a large-scale pre-trained large language model to perform task-oriented network fine-tuning, making full use of the prior knowledge of the language model, realizing top-down word-level text recognition, and avoiding the problems of large amounts of noise and low efficiency in character-level recognition;

[0038] Moreover, the present invention has good application value in scenes such as scene understanding and autonomous driving. For example, in autonomous driving tasks, the text in the scene contains a large amount of information that helps understand the scene and assists driving. Accurately detecting the location of the text and identifying the text content is the basis for utilizing the scene text information. The scene text detection and text recognition method of the present invention can quickly and accurately extract the text content in the image, providing a basis for the subsequent use and analysis of the text information. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of a flow chart of a scene text detection and recognition method based on a cross-modal large language model of the present invention;

[0040] Figure 2 is the original image in the embodiment of the present invention;

[0041] Figure 3 A framework diagram of a learning network of the present invention;

[0042] Figure 4 This is a diagram showing the detection effect of a cross-modal large language model in an embodiment of the present invention on a text target in a natural scene image;

[0043] Figure 5 The present invention is a schematic diagram of the structure of a scene text detection and recognition device based on a cross-modal large language model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical scheme and technical effect of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0045] In scene text detection and recognition, the recognition task usually depends on the result of the detection task, which leads to complex method flow and low efficiency. Therefore, the present invention performs top-down text detection and recognition based on a cross-modal encoding and decoding mechanism and a large language model, runs the two subtasks in parallel, and optimizes the network through an effective training strategy. Specifically, a scene text detection and recognition method and device based on a cross-modal large language model are proposed, which has the advantages of simple implementation method, flexible and robustness, and wide application range.

[0046] More detailed, such as Figure 1 As shown, the scene text detection and recognition method based on a cross-modal large language model comprises the following steps:

[0047] Step 1: Obtain multiple sets of image-text datasets with true value annotations for training scene text detection. Specifically, the present invention is implemented on the academic public dataset ICDAR2013 with true value annotations;

[0048] Step 2: Use the image encoder to extract and learn features of the images in the dataset to obtain feature embedding of the image modality.

[0049] The specific implementation method of this step includes:

[0050] (2.1) Use the backbone network to extract deep features of each image;

[0051] (2.2) The multi-head attention mechanism is used to extract and fuse the deep feature map to obtain the feature embedding of the image modality, that is, the image feature vector sequence X = [x1, x2, ..., x N ].

[0052] Step three: fuse the obtained image modal feature embedding with the corresponding truth-value labeled text embedding to construct a multimodal feature sequence of image and natural language.

[0053] The specific implementation method of this step includes:

[0054] (3.1) Use the image feature vector sequence obtained in step 2 and the true value annotation of the text target content and its center point coordinates to construct the text input. The text input template is “The texts in the image<image_features> are:instance_1[center_x 1 ,center_y 1 ];instance_2[center_x 2 ,center_y 2 ];...;instance_K[cen ter_x K ,center_y K ];"in<image_features> Corresponding image feature sequence X = [x1, x2, ..., x N ], instance_K represents the text content of the Kth text target contained in the image (such as "Love"), center_x K and center_y K Represents the center point position coordinates of the text object (such as 123, 234);

[0055] (3.2) Use the dictionary to convert the text part in the text input template into the corresponding feature vector T = [t1, t2, ..., t j ,t L ], such as "The" corresponds to t1, "texts" corresponds to t2, and the text of instance1 corresponds to t j , coordinate center_y K The value of t L-2 ";" corresponds to t L , thereby combining the image modality feature sequence X to construct a multimodal feature sequence of image and natural language: [t0, t1, t2, ..., x1, x2, ..., x N ,...,t j ,...,t L ,t L+1 ], where t0 represents the start symbol [BOS], t L+1 represents the termination symbol [EOS], and L+N=M. For the sake of simplicity, the fused multimodal sequence is represented as Y=[y0,y1,...,y M+1 ].

[0056] Step 4: Input the above fused multimodal feature sequence into the large language model for cross-modal encoding and decoding, and perform network fine-tuning under the autoregressive mechanism based on the initialized model parameters of large-scale pre-training.

[0057] The specific implementation method of this step includes:

[0058] (4.1) All instance texts and coordinates in the second half of the multimodal sequence Y fused in step 3, i.e. [y q ,...,y M+1 ], as the learning target of the model, a large-scale pre-trained model is used for parameter initialization, and the autoregressive mechanism is used for model training;

[0059] (4.2) The autoregressive mechanism predicts the learning targets in the sequence one by one. Specifically, when predicting the target y q When the model is based on the given sequence y0 to y q-1 There are q feature sequences to predict; when predicting the target y q+1 When the model uses y0 to y q There are q+1 feature sequences to predict. q to y M+1 The model is trained by predicting each one and calculating the loss with the true value; the loss function of the language model is:

[0060]

[0061] Among them, CE(·) is the cross entropy loss function.

[0062] Step 5: During the testing phase, the text image is input into the trained image encoder and large language model, and the network output is translated into the content and position of the text target contained in the current image through linear classification and category lookup.

[0063] The specific implementation method of this step includes:

[0064] In the test phase, we first extract features from the given input image to obtain a feature vector sequence X, and then compare it with the text input template “The texts in the image<image_features> are:"The feature sequence [y0,y1,...,y q-1 ] is input into the language model, and the model uses the autoregressive mechanism to predict y one by one q to y M+1 , and then converted into the ID category corresponding to the text or number through the linear classification layer, and finally the specific text or coordinate number is obtained by looking up the table according to the category, that is, "instance_1[center_x 1 ,center_y 1 ];instance_2[center_x 2 ,center_y 2 ];...;instance_K[c enter_xK ,center_y K ];", thereby completing the task of text detection and recognition.

[0065] The above method is applied to a specific embodiment below so that those skilled in the art can better understand the effect of the present invention.

[0066] Example 1

[0067] The implementation method of this embodiment is as described above, and the specific steps will not be elaborated in detail. The following only shows its effect based on case data. The present invention uses the large-scale synthetic dataset SynthText and COCOText datasets with true value annotations, which are widely used for text detection and text recognition model pre-training, as supplementary training data. It is implemented on the public academic dataset ICDAR2013 with true value annotations. The dataset contains 229 training images and 233 test images. For example, the images in the dataset are Figure 2 shown.

[0068] The main process of text detection and text recognition is as follows:

[0069] 1) Use the image encoder to extract features from the images in the dataset and obtain feature embedding of the image modality;

[0070] 2) The obtained image modality feature embedding is fused with the corresponding truth-valued annotated text embedding to construct a multimodal feature sequence of image and natural language;

[0071] 3) Input the above fused multimodal feature sequence into the large language model for cross-modal encoding and decoding, and perform network fine-tuning under the autoregressive mechanism based on the initialization model parameters of large-scale pre-training;

[0072] 4) Input the text image into the trained image encoder and large language model, and translate the network output into the content and position of the text target contained in the current image through linear classification and category lookup. The overall learning network framework is as follows: Figure 3 As shown in the figure, the detection effect of random morphological text in natural scene images is as follows Figure 4 shown.

[0073] In order to comprehensively compare the effectiveness of this method, other advanced methods are compared. The comprehensive score F-measure of the experimental results of this embodiment is shown in Table 1. F-measure represents the balanced comprehensive performance between precision and recall: The data in the table show the performance of the present invention on four indicators, F-measure and FPS, under generic dictionary constraints (Generic), weak dictionary constraints (Weak) and strong dictionary constraints (Strong). Among them, the generic dictionary constraint allows the use of a dictionary containing 90,000 entries to query and correct the recognition results, the weak dictionary constraint allows the use of all entries that have appeared in the entire data set for query correction, and the strong dictionary constraint allows the use of a dictionary with a capacity of 100 entries, including all entries and interference items of the current image, for query correction. When determining the accuracy of text detection, the standard of this method is that if the predicted center point coordinates exist within the text area, it is judged to be correct. When determining the accuracy of text recognition, the standard of this method is that if the recognized string is completely consistent with the true value without distinguishing between uppercase and lowercase letters, it is judged to be correct. Compared with other methods based on the two-stage framework of unimodal learning, this method has achieved very competitive results.

[0074] Table 1 shows the evaluation indicators of this embodiment on the ICDAR2013 dataset:

[0075] Table 1

[0076] Method Generic Weak Strong Jaderberg et al. - - 86.4 Textboxes 83.9 89.7 91.6 Deep Text Spotter 77.0 86.0 89.0 Li et al. 84.6 89.8 91.1 Ours 83.9 89.3 91.9

[0077] Through the above technical solutions, the present invention implements a scene text detection and recognition method based on a cross-modal large language model based on deep learning technology. The present invention can mine the visual attributes and language attributes of text on various real image data, thereby obtaining accurate detection and recognition results.

[0078] Corresponding to the above-mentioned embodiment of the scene text detection and recognition method based on the cross-modal large language model, the present invention also provides an embodiment of a scene text detection and recognition device based on the cross-modal large language model. A scene text detection and recognition device based on the cross-modal large language model includes the following modules:

[0079] Obtaining dataset module: Obtaining several sets of existing image-text datasets with true value annotations for training scene text detection;

[0080] Feature extraction module: Use the image encoder to extract and learn features of images in the dataset to obtain feature embedding of the image modality;

[0081] Fusion construction module: fuses the acquired image modality feature embedding with the corresponding truth-value annotated text embedding to construct a multimodal feature sequence of image and natural language;

[0082] Fine-tuning network module: The multimodal feature sequence obtained by the fusion construction module is input into the large language model for cross-modal encoding and decoding, and the network is fine-tuned under the autoregressive mechanism based on the initialization model parameters of large-scale pre-training;

[0083] Detection module: During detection, the text image is input into the trained image encoder and large language model mentioned above, and the network output is translated into the content and location of the text target contained in the current image through linear classification and category lookup.

[0084] See also Figure 5 An electronic device provided by an embodiment of the present invention includes one or more processors for implementing the scene text detection and recognition method based on a cross-modal large language model in the above embodiment.

[0085] The embodiments of the scene text detection and recognition device based on the cross-modal large language model of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the internal memory for execution. From a hardware perspective, if Figure 5 As shown, it is a hardware structure diagram of any device with data processing capability where the scene text detection and recognition device based on the cross-modal large language model of the present invention is located, except Figure 5 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.

[0086] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0087] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.

[0088] An embodiment of the present invention further provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, the steps of the scene text detection and recognition method based on a cross-modal large language model in the above embodiment are implemented.

[0089] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device of a wind turbine, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.

[0090] The above is only a preferred implementation case of the present invention and does not limit the present invention in any form. Although the implementation process of the present invention is described in detail above, for those familiar with the art, they can still modify the technical solutions recorded in the above examples, or replace some of the technical features therein with equivalents. All modifications, equivalent replacements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A scene text detection and recognition method based on a cross-modal large language model, It is characterized in that The following steps are involved: (1) Obtain several sets of existing image-text datasets with true value annotations for training scene text detection; (2) Use the image encoder to extract and learn features from the images in the dataset to obtain feature embedding of the image modality; (3) The obtained image modality feature embedding is fused with the corresponding truth-valued annotated text embedding to construct a multimodal feature sequence of image and natural language; It includes the following sub-steps: (3.1) Use the image feature vector sequence obtained in step (2) and the true value annotation of the text target content and its center point coordinates to construct the text input. The text input template is "The texts in the image<image_features> are:instance_1[center_x 1 ,center_y 1 ]; instance_2[center_x 2 ,center_y 2 ];...;instance_K[cen ter_x K ,center_y K ];"in<image_features> Corresponding image feature sequence X = [x 1 ,x 2 ,...,x N ], instance_K represents the text content of the Kth text target contained in the image, center_x K and center_y K Represents the center point position coordinates of the text target; (3.2) Use the dictionary to convert the text part in the text input template into the corresponding feature vector, T = [t 1 ,t 2 ,...,t j ,t L ], "The" corresponds to t 1 ,"texts" corresponds to t 2 , the text of instance1 corresponds to t j , coordinate center_y K The value of t L-2 , ";" corresponds to t L , thereby combining the image modality feature sequence X to construct a multimodal feature sequence of image and natural language: [t 0 ,t 1 ,t 2 ,...,x 1 ,x 2 ,...,x N ,...,t j ,...,t L ,t L+1 ], where t 0 Indicates the starting symbol [BOS], t L+1 represents the termination symbol [EOS], and L+N=M; the fused multimodal sequence is simply represented as Y=[y 0 ,y 1 ,...,y M+1 ]; (4) Input the multimodal feature sequence obtained in step (3) into the large language model for cross-modal encoding and decoding, and perform network fine-tuning under the autoregressive mechanism based on the initialization model parameters of large-scale pre-training; specifically: (4.1) All instance texts and coordinates in the second half of the multimodal sequence Y after fusion in step (3), i.e. [y q ,...,y M+1 ], as the learning goal of the model; (4.2) Use a large-scale pre-trained model to initialize parameters and use the autoregressive mechanism to train the model; (4.3) The autoregressive mechanism predicts the learning targets in the sequence one by one; specifically, when predicting the target y q When the model is based on the given sequence y 0 to y q-1 There are q feature sequences to predict; when predicting the target y q+1 When 0 to y q There are q+1 feature sequences to predict; and so on, from y q to y M+1 Train the model by predicting each one and calculating the loss with the true value; (5) During detection, the text image is input into the trained image encoder and large language model, and the network output is translated into the content and position of the text target contained in the current image through linear classification and category lookup. Specifically: During detection, we first extract features from a given input image to obtain a feature vector sequence X, and then compare it with the text input template "The texts in the image<image_features> are:"The characteristic sequence [y 0 ,y 1 ,...,y q-1 ] is input into the language model, and the model uses the autoregressive mechanism to predict y one by one q to y M+1 , and then converted into the ID category corresponding to the text or number through the linear classification layer, and finally the specific text or coordinate number is obtained by looking up the table according to the category, that is, "instance_1[center_x 1 ,center_y 1 ]; instance_2[center_x 2 ,center_y 2 ]; ...; instance_K[center_x K ,center_y K ];", thereby completing the task of text detection and recognition.

2. A scene text detection and recognition method based on a cross-modal large language model as claimed in claim 1, It is characterized in that The step (2) specifically includes the following sub-steps: (2.1) Use the backbone network to extract deep features of each image; (2.2) The multi-head attention mechanism is used to extract and fuse the deep feature map to obtain the feature embedding of the image modality, that is, the image feature vector sequence X = [x 1 ,x 2 ,...,x N ].

3. The scene text detection and recognition method based on a cross-modal large language model as claimed in claim 1, It is characterized in that In step (4), from y q to y M+1 The model is trained by predicting each one and calculating the loss with the true value. The loss is calculated using the loss function of the language model, which is expressed as: Among them, CE(·) is the cross entropy loss function.

4. A scene text detection and recognition device based on a cross-modal large language model, It is characterized in that The device includes the following modules: Obtaining dataset module: Obtaining several sets of existing image-text datasets with true value annotations for training scene text detection; Feature extraction module: Use the image encoder to extract and learn features of images in the dataset to obtain feature embedding of the image modality; Fusion construction module: fuses the acquired image modality feature embedding with the corresponding truth-value annotated text embedding to construct a multimodal feature sequence of image and natural language; Specifically: The text input is constructed by using the image feature vector sequence obtained by the feature extraction module and the true value annotation of the text target content and its center point coordinates. The text input template is "The texts in the image<image_features> are:instance_1[center_x 1 ,center_y 1 ]; instance_2[center_x 2 ,center_y 2 ]; ...; instance_K[center_x K ,center_y K ];"in<image_features> Corresponding image feature sequence X = [x 1 ,x 2 ,...,x N ], instance_K represents the text content of the Kth text target contained in the image, center_x K and center_y K Represents the center point position coordinates of the text target; Use the dictionary to convert the text part in the text input template into the corresponding feature vector, T = [t 1 ,t 2 ,...,t j ,t L ], "The" corresponds to t 1 ,"texts" corresponds to t 2 , the text of instance1 corresponds to t j , coordinate center_y K The value of t L-2 , ";" corresponds to t L , thereby combining the image modality feature sequence X to construct a multimodal feature sequence of image and natural language: [t 0 ,t 1 ,t 2 ,...,x 1 ,x 2 ,...,x N ,...,t j ,...,t L ,t L+1 ], where t 0 Indicates the starting symbol [BOS], t L+1 represents the termination symbol [EOS], and L+N=M; the fused multimodal sequence is simply represented as Y=[y 0 ,y 1 ,...,y M+1 ]; Fine-tuning network module: input the multimodal feature sequence obtained by the fusion construction module into the large language model for cross-modal encoding and decoding, and perform network fine-tuning under the autoregressive mechanism based on the initialization model parameters of large-scale pre-training; specifically: input all instance texts and coordinates of the second half of the multimodal sequence Y fused by the fusion construction module, that is, [y q ,...,y M+1 ], as the learning target of the model; use a large-scale pre-trained model to initialize parameters, and use the autoregressive mechanism to train the model; the autoregressive mechanism predicts the learning targets in the sequence one by one; the autoregressive mechanism predicts the learning targets in the sequence one by one, specifically: in the prediction target y q When the model is based on the given sequence y 0 to y q-1 There are q feature sequences to predict; when predicting the target y q+1 When 0 to y q There are q+1 feature sequences to predict; and so on, from y q to y M+1 Train the model by predicting each one and calculating the loss with the true value; Detection module: During detection, the text image is input into the trained image encoder and large language model, and the network output is translated into the content and location of the text target contained in the current image through linear classification and category lookup. Specifically, during detection, we first extract features from a given input image to obtain a feature vector sequence X, and then compare it with the text input template "The texts in the image<image_features> are:"The characteristic sequence [y 0 ,y 1 ,...,y q-1 ] is input into the language model, and the model uses the autoregressive mechanism to predict y one by one q to y M+1 , and then converted into the ID category corresponding to the text or number through the linear classification layer, and finally the specific text or coordinate number is obtained by looking up the table according to the category, that is, "instance_1[center_x 1 ,center_y 1 ]; instance_2[center_x 2 ,center_y 2 ]; ...; instance_K[center_x K ,center_y K ];", thereby completing the task of text detection and recognition.

5. An electronic device, It is characterized in that It includes one or more processors, used to implement the scene text detection and recognition method based on a cross-modal large language model as described in any one of claims 1-3.

6. A computer-readable storage medium, It is characterized in that A program is stored thereon, and when the program is executed by a processor, the steps of the scene text detection and recognition method based on a cross-modal large language model described in any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Multi-modal pre-training method based on image-text linear combination

    CN114298158A

  • Depth scene text detection method and device based on fuzzy semantic modeling

    CN114972947A