Visual text processing method and device, electronic equipment, medium and program product

By extracting and integrating the characteristics of visual text and using the target model for processing, the problem of single function of the visual text processing model in the existing technology is solved, efficient and flexible visual text processing is achieved, and the accuracy of the processing results and the model are improved. Versatility.

CN118736557APending Publication Date: 2024-10-01DOUYIN VISION CO LTD

Patent Information

Application Number
CN202410868039.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing visual text processing model has a single function and is difficult to handle a large number of different types of visual text tasks, resulting in excessive storage consumption.

Method used

By extracting the visual features of the target image and the text features of the prompt text, they are integrated into features to be processed, and processed using the language processing module and task processing sub-module in the target model to improve processing efficiency and accuracy.

Benefits of technology

It achieves more efficient and flexible visual text processing, improves the accuracy of processing results and the versatility of the model, reduces dependence on multiple models, and reduces storage consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736557A_ABST
    Figure CN118736557A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, and discloses a visual text processing method and device, electronic equipment, a medium and a program product. The visual text processing method provided by the invention comprises the following steps: acquiring a target image of a current visual task and a corresponding prompt text; extracting visual features of the target image and text features of the prompt text to obtain to-be-processed features; and inputting the to-be-processed features into a target model, and processing the to-be-processed features by using a language processing module in the target model and a target task processing sub-module corresponding to the current visual task to obtain a processing result of the current visual task. The processing efficiency can be effectively improved, the processing process is more flexible and more targeted, and the accuracy of the processing result can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer vision technology, and in particular to a visual text processing method, device, electronic device, medium and program product. Background Art

[0002] Visual text is a creative form of expression that combines visual elements and text information. It displays information in a more intuitive and vivid way through the organic combination of images, colors and text.

[0003] In the related technology, the models for processing visual text (documents, scene text) perform relatively single functions. Therefore, when a large number of different types of visual text processing tasks need to be performed, multiple models need to be used together for processing, which greatly increases the storage consumption of the model. Summary of the invention

[0004] In view of this, the present disclosure provides a visual text processing method, device, electronic device, medium and program product to solve the problem that the model for processing visual text is not universal.

[0005] In a first aspect, the present disclosure provides a visual text processing method, the method comprising:

[0006] Get the target image of the current visual task and the corresponding prompt text;

[0007] Extracting visual features of the target image and text features of the prompt text to obtain features to be processed;

[0008] The features to be processed are input into the target model, and the language processing module in the target model and the target task processing submodule corresponding to the current visual task are used to process the features to obtain the processing result of the current visual task.

[0009] In a second aspect, the present disclosure provides a visual text processing device, the device comprising:

[0010] The acquisition module is used to obtain the target image of the current visual task and the corresponding prompt text;

[0011] The first processing module is used to extract the visual features of the target image and the text features of the prompt text to obtain features to be processed;

[0012] The second processing module is used to input the features to be processed into the target model, and use the language processing module in the target model and the target task processing submodule corresponding to the current visual task to process the features to be processed, so as to obtain the processing result of the current visual task.

[0013] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the visual text processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0014] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the visual text processing method of the first aspect or any corresponding embodiment thereof.

[0015] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the visual text processing method of the first aspect or any corresponding embodiment thereof.

[0016] The visual text processing method provided in this embodiment helps to capture different aspects of information in multimodal input data by extracting the visual features of the target image and the text features of the prompt text and integrating them into features to be processed. When processed by the target model, the features to be processed can provide a more comprehensive and integrated description, which is convenient for the target model to better understand and process the current visual task, and can effectively improve the processing efficiency. In addition, in the process of processing the features to be processed, the target model uses the built-in language processing module and the target task processing submodule corresponding to the current visual task to process them, thereby making the processing process more flexible and targeted, and can effectively improve the accuracy of the processing results. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 is a flowchart of a visual text processing method provided according to some embodiments of the present disclosure;

[0019] Figure 2 is a structural diagram of a task processing module provided according to some embodiments of the present disclosure;

[0020] Figure 3 is a schematic diagram of the structure of a target model provided according to some embodiments of the present disclosure;

[0021] Figure 4is a structural block diagram of a visual text processing device according to some embodiments of the present disclosure;

[0022] Figure 5 is an example diagram of a target image according to some embodiments of the present disclosure;

[0023] Figure 6 is an example diagram of target processing results according to some embodiments of the present disclosure;

[0024] Figure 7 is an example diagram of another target image according to some embodiments of the present disclosure;

[0025] Figure 8 is a structural block diagram of another visual text processing device according to some embodiments of the present disclosure;

[0026] Fig. 9 It is a schematic diagram of the hardware structure of an electronic device according to some embodiments of the present disclosure. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0028] The models that process visual text (documents, scene text) perform relatively simple functions. Therefore, when a large number of different types of visual text processing tasks need to be performed, multiple models need to be used together, which greatly increases the storage consumption of the model.

[0029] In view of this, the embodiments of the present disclosure provide a visual text processing method, which, through a target model, can autonomously identify the current visual task to be executed based on the obtained target image and prompt text, and then perform targeted processing to obtain the processing result of the current visual task, so that the visual task can be processed more efficiently and flexibly.

[0030] According to an embodiment of the present disclosure, an embodiment of a visual text processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0031] In this embodiment, a visual text processing method is provided, which can be used in the above-mentioned electronic devices, such as mobile phones, tablet computers, etc. Figure 1is a flowchart of a visual text processing method according to an embodiment of the present disclosure. Figure 1 As shown, the process includes the following steps:

[0032] Step S101, obtaining the target image of the current visual task and the corresponding prompt text.

[0033] The current visual task refers to the vision-related task currently to be processed, such as image perception tasks, image understanding tasks, etc. Image perception tasks include but are not limited to edge detection, texture analysis, object detection, feature extraction, etc. Image understanding tasks include but are not limited to image classification, object recognition, scene understanding, visual question answering, image description generation, etc. The specific current visual task can be determined according to actual needs.

[0034] The target image is the object to be analyzed and processed in the current visual task. The prompt text is used to provide relevant text description or prompt information for performing the current visual task on the target image, such as the scene of the image, the characteristics of the object, etc., so that the subsequent target model can better understand the meaning and intention of the target image when performing the current visual task.

[0035] Step S102, extracting visual features of the target image and text features of the prompt text to obtain features to be processed.

[0036] Visual features refer to features related to the image content extracted from the target image, such as color, shape, contour, texture, etc. Text features refer to features related to the text content extracted from the prompt text, such as vocabulary, semantics, grammar, etc.

[0037] In order to facilitate the target model to perform the current visual task, the features of the target image and the prompt text are extracted respectively, and the visual features of the target image are integrated with the text features of the prompt text to obtain the features to be processed that can characterize the target image and the prompt text, so that the target model can better understand and process the relationship between the target image and the prompt text according to the features to be processed, thereby improving the processing ability of performing visual tasks.

[0038] In some examples, the process of integrating the visual features and the text features may be integrated by feature splicing. For example, the splicing is performed in a specified order. The visual features are placed in front and the text features are placed in the back. Alternatively, the text features are placed in front and the visual features are placed in the back.

[0039] Step S103, input the feature to be processed into the target model, use the language processing module in the target model and the target task processing submodule corresponding to the current visual task to process the feature to be processed, and obtain the processing result of the current visual task.

[0040] The target model is a language model that can process multimodal information and can perform a variety of different visual tasks. The target model includes but is not limited to a language processing module and a target task processing submodule. The language processing module is used to process and understand the information represented by the features to be processed, and the target task processing submodule is a module specifically used to process the current visual task.

[0041] In order to meet the processing requirements of the current visual task, the features to be processed are input into the target model, and the language processing module is used to analyze the features to be processed so that the image content in the target image and the text content in the prompt text can be fully understood, and then targeted integration is performed, so that targeted processing is performed through the target task processing sub-module corresponding to the current visual task, so that the processing process of the visual task is more flexible, which can effectively improve the accuracy and effect of processing the current visual task.

[0042] The visual text processing method provided in this embodiment helps to capture different aspects of information in multimodal input data by extracting the visual features of the target image and the text features of the prompt text and integrating them into features to be processed. When processed by the target model, the features to be processed can provide a more comprehensive and integrated description, which is convenient for the target model to better understand and process the current visual task, and can effectively improve the processing efficiency. In addition, in the process of processing the features to be processed, the target model uses the built-in language processing module and the target task processing submodule corresponding to the current visual task to process them, thereby making the processing process more flexible and targeted, and can effectively improve the accuracy of the processing results.

[0043] In some optional embodiments, the visual features are obtained by performing feature extraction processing on the target image through a preset visual encoder. Among them, the visual encoder is a model for converting an image into a feature vector. In order to obtain the image content in the target image, the target image is subjected to feature extraction processing through the visual encoder, and then the visual features that can characterize the image content of the target image are obtained. In some examples, the visual encoder can be a model composed of a visual transformer (ViT, Vision Transformer) and a visual compressor (Q-former). Q-former is a visual compressor based on quantization perception, which can compress the image while maintaining high image quality. The target image is divided into several small blocks through ViT, and each small block is regarded as a word, and then the Transformer model is used to encode and process these words to extract the features of the image and obtain the initial visual features. Then the initial visual features are compressed using Q-former, and the attention mechanism is used to extract features of the target image to improve the image representation ability, thereby obtaining the visual features of the target image. For example, in the process of extracting features of a target image through an 896*896 visual encoder, ViT can convert the target image into 64*64=4096 initial visual features, and then compress the initial visual features through Q-former to obtain 512 visual features that can represent the image content of the target image.

[0044] In other examples, the visual encoder can be a model based on a convolutional neural network (CNN) or a recurrent neural network (RNN) framework.

[0045] In some optional implementations, the text features may be obtained by extracting features from the prompt text using a preset text marker.

[0046] In some optional embodiments, the target model includes multiple language processing modules, and task processing modules corresponding to the language processing modules, the task processing modules include a task selection submodule, a first task processing submodule for image generation, a second task processing submodule for image understanding, and a third task processing submodule for image generation and understanding, and the task selection submodule is used to determine the target task processing submodule based on the features to be processed.

[0047] That is, the target model is a model that combines multiple modal information for language processing. It consists of multiple language processing modules and task processing modules corresponding to the language processing modules. Among them, the language processing module is a deep learning model for natural language processing and other sequence data processing tasks, for example, for understanding and analyzing the features to be processed. The task processing module is a module for targeted processing of the features to be processed according to the current visual task.

[0048] Among them, the task selection submodule in the task processing module is used to identify the current visual task corresponding to the feature to be processed, and determine the target task processing submodule corresponding to the current visual task. The first task processing submodule is used to perform image generation tasks on the input features to be processed. The second task processing submodule is used to perform image understanding tasks on the input features to be processed. The third task processing submodule is a module for the comprehensive task of image generation and understanding of the input features to be processed, which can not only generate images, but also understand and interpret images, thereby helping to improve the generalization ability of the target model. By setting different task processing submodules, the target model can focus on different visual tasks and provide more professional and efficient processing capabilities.

[0049] After the features to be processed are input into the target model, the language processing model is used to understand the information represented by the features to be processed, and the task selection submodule is used to determine the target task processing submodule based on the features to be processed. Then, the target task processing submodule is used to perform targeted processing on the features to be processed according to the current visual task to obtain the processing result of the current visual task, which helps to improve the adaptability and versatility of the target model, thereby effectively improving the processing performance and accuracy of the target model on related visual tasks.

[0050] In some optional examples, the task processing module corresponds to the language processing module one-to-one, and each task processing module can focus on the corresponding visual task, which can effectively improve the reliability and accuracy of the processing results. In addition, since the task processing module and the language processing module are in a one-to-one correspondence, it helps to clearly divide the responsibilities of task processing and language processing, making development, maintenance and upgrading easier to manage, and when modifying or adjusting the structure of the target model, the flexibility of maintenance can be improved, which is convenient for adapting to the ever-changing task requirements and the development of language processing technology, thereby improving the generalization ability and practicality of the target model.

[0051] In some other optional examples, a task processing module is provided between any two adjacent language processing modules. That is, the number of task processing modules is the same as the number of language processing models. The input of the current task processing module is the output of the previous language processing model; the output of the current task processing module is the input of the next language processing model, so that the input-output relationship of each module is clearer and more specific, which can effectively avoid data confusion and erroneous transmission. In addition, by inserting a task processing module between two adjacent language processing modules, the entire feature processing process can be decomposed into multiple stages, and then processed in stages, which can effectively improve the comprehensibility and debuggability of the target model, thereby helping to improve the target model's processing capabilities for different visual tasks.

[0052] In some optional implementations, the above step S103 includes:

[0053] Step a1, using the language processing module to understand the input features and obtain the labeled task processing features;

[0054] Step a2, using the task selection submodule to understand the task processing features and determine the target task processing submodule;

[0055] Step a3: Use the target task processing submodule to process the task processing features to obtain the processing result of the current visual task.

[0056] The target task processing submodule includes a third task processing submodule and one of the first task processing submodule and the second task processing submodule.

[0057] Specifically, for each layer of language processing module and task processing module, the language processing module first understands the input features to clarify the information represented by the input features, and then specifically annotates them to obtain the annotated task processing features. Among them, if the language processing module is the first-layer language processing module in the target model, the input features input to the language processing module are the features to be processed. If the language processing module is the middle-layer language processing module in the target model, the input features input to the language processing module are the output features of the target task processing submodule in the previous layer of task processing module. The length of the input feature is the same as that of the output feature.

[0058] The task selection submodule is used to understand the task processing features to identify the current visual task, and then the target task processing submodule is determined from multiple task processing submodules, and the target task processing submodule is used to perform targeted processing on the task processing features. This can improve the processing focus on the input feature and achieve orderly processing and resolution of the visual task, thereby helping to ensure the accuracy and efficiency of the final processing results of the current visual task.

[0059] In some optional implementation scenarios, the structure of the task processing module is as follows: Figure 2 As shown. That is, the target task selection submodule is connected to the first task processing module and the second task processing module respectively; the first task processing module, the second task processing module and the third task processing module are independently deployed in the same level. The target task selection submodule can be composed of two layers of Feed-Forward Neural Network (FFN), and then when identifying the current visual task, targeted identification can be performed based on the contextual content of the task processing features, thereby helping to improve the determination accuracy of the target task processing submodule and facilitate better processing of various visual tasks. Specifically, the first layer of the neural network can perform preliminary feature extraction and abstraction on the features to be processed so that the second layer of the neural network can better understand and process these features.

[0060] The first task processing module, the second task processing module and the third task processing module are low-rank adaptation models with the same model structure but different functions, which are used to map the obtained task processing features to their respective corresponding visual tasks for targeted processing.

[0061] When the target task selection submodule determines that the current visual task is an image processing task, the connection between the target task selection submodule and the second task processing module is disconnected, and then the first task processing module and the third task processing module process the task processing features separately, and merge the processing results obtained by each module to obtain the result after the target task processing submodule processes the task processing features.

[0062] When the target task selection submodule determines that the current visual task is an image generation task, the connection between the target task selection submodule and the first task processing module is disconnected, and then the second task processing module and the third task processing module process the task processing features respectively, and merge the processing results obtained by each module to obtain the result after the target task processing submodule processes the task processing features.

[0063] In some other optional implementation scenarios, for ease of description, the process of processing using the task processing module can be expressed using the following formula:

[0064] y=0.5*{[G(x)≥m]*V(x)+[G(x) <m]*T(x)+s(x)};

[0065] Among them, y represents the result after the target task processing sub-module processes the task processing features, and m represents the minimum confidence threshold for determining that the current visual task is an image processing task. If [G(x)≥m] is true (TRUE), then [G(x)≥m]=1; if [G(x)≥m] is false (FALSE), then [G(x)≥m]=0. Similarly, if [G(x)<m] is true (TRUE), then [G(x)<m]=1; if [G(x)<m] is false (FALSE), then [G(x)<m]=0. Preferably, the minimum confidence threshold is 0.5, which helps to quickly identify the current view task.

[0066] In some other alternative embodiments, the target model further includes a result generation module corresponding to the visual task. The above step S103 further includes:

[0067] Step b1: Determine the target result generation module corresponding to the current visual task based on the target task processing sub-module determined by the task selection sub-module;

[0068] Step b2: Use the target result generation module to process the target features obtained after being processed by multiple language processing modules and the target task processing sub-module to obtain the processing result of the current visual task.

[0069] Specifically, since the data modalities corresponding to the processing results of different visual tasks are different. For example, for an image understanding task, the data modality corresponding to the processing result is text data. And for an image generation task, the data modality corresponding to the processing result is image data. Therefore, to ensure that the processing result of the current visual task can be effectively output, the target result generation module corresponding to the current visual task is determined based on the target task processing sub-module determined by the task selection sub-module, so as to alleviate the modality conflict problem between image understanding and image generation, thereby achieving the purpose of improving the processing performance of visual tasks.

[0070] After multiple language processing modules and the target task processing sub-module process the to-be-processed features, the target result generation module is used to decode and restore the obtained target features, so as to obtain the processing result of the current visual task.

[0071] In some optional implementation scenarios, if the current visual task is an image generation task, the target result generation module is a conditional diffusion model, and when the target result generation module is used to process the target feature, the target feature can be parsed by Gaussian noise built into the conditional diffusion model to obtain a visual image for editing the target image according to the prompt text, and the visual image is used as the target processing result. Among them, the conditional diffusion model is a deep learning model for image generation and editing. The process of feature decoding of the target feature using Gaussian noise can be as follows: first, Gaussian noise is used as input, and the noise is gradually reduced in each time step, while guiding according to the given target feature. During the feature decoding process, the conditional diffusion model predicts the next denoising operation based on the current noise state and the target feature. Specifically, it transforms and processes the current noise feature to gradually remove the noise and generate clearer features. In each iteration, the conditional diffusion model combines the current noise feature with the predicted denoising operation to generate a new feature, and continues this process until a target processing result that meets the conditions is generated.

[0072] In other optional implementation scenarios, if the current visual task is an image understanding task, the target result generation module is a text marker, and when the target feature is processed using the target result generation module, the target feature can be parsed by the text marker to obtain a description text for understanding the target image according to the prompt text, so as to understand the content, meaning and related information of the target image, and then use the description text as the target processing result.

[0073] In some alternative implementation scenarios, Figure 3 Schematic diagram of the structure of the target model according to the embodiment of the present disclosure. Figure 3 As shown, the target model includes multiple language processing modules, task processing modules alternately connected to each language processing module, a text tagger, and a conditional diffusion model. If the current visual task is an image generation task, the target processing result is output through the conditional diffusion model. If the current visual task is an image understanding task, the target processing result is output through the text tagger.

[0074] Combination Figure 3 The target model shown in the figure, the process of training the target model is as follows:

[0075] Step c1, obtaining feature samples to be processed, the feature samples to be processed are composed of visual feature samples of image samples and text feature samples of prompt text samples;

[0076] Step c2, in the process of inputting the feature sample to be processed into the initial model for model training, determining the loss function value corresponding to the result generation module;

[0077] Step c3: If all loss function values ​​are less than the specified threshold, the model training is terminated, and the target model is obtained based on the current parameters of the initial model.

[0078] Specifically, since different visual tasks correspond to different modal data, in order to enable the target model to effectively understand the image content and text content, and perform targeted processing according to different visual tasks, the loss function value corresponding to each result generation module is generated during the training process to measure the difference between the model's predicted results and the actual results and determine the current training progress.

[0079] When the loss function values ​​corresponding to all result generation modules are less than the specified threshold, it can be considered that the model has converged to a better state, and then the training is stopped, and the fixed parameters are processed according to the current parameters of the initial model to obtain the final target model.

[0080] In some optional examples, the cross entropy classification loss function can be used to determine the loss function value of the result generation module corresponding to the image understanding task, and then the loss function value can be used to determine the convergence of the initial model processing the image understanding task. In other optional examples, the mean square error regression loss function can be used to determine the loss function value of the result generation module corresponding to the image generation task, and then the loss function value can be used to determine the convergence of the initial model processing the image generation task.

[0081] As one or more specific application embodiments of the embodiments of the present disclosure, the framework schematic diagram of the visual text processing device for processing visual text can be as follows: Figure 4 As shown. Among them, the visual encoder is used to extract the visual features of the target image, and the first text marker is used to extract the text features of the prompt text. The target model is used to determine the current visual task to be processed based on the input features to be processed (visual features + text features), and perform targeted processing according to the current visual task. If the current visual task is an image understanding task, the output target processing result is the description text of the target image understood according to the prompt text, and the description text is used as the target processing result. If the current visual task is an image generation task, the output target processing result is the visual image of the target image edited according to the prompt text.

[0082] For example: If the current visual task is an image generation task, the target image obtained is Figure 5 As shown in the figure, the corresponding prompt text is "fill the blocked part of the image with "play", then Figure 4 The visual text processing device shown can obtain Figure 6 Target processing results are shown.

[0083] If the current visual task is an image understanding task, the target image obtained is Figure 7 As shown in the figure, the corresponding prompt text is "Find and identify all the text content in this picture", then Figure 4 The visual text processing device shown can obtain the following target processing results:

[0084] SOUTHERN MOST[140,144,428,148]

[0085] HOTEL[208,196,331,196]

[0086] IN THE USA[228,200,331,220]

[0087] RECEPTION[188,265,331,306]

[0088] In this embodiment, a visual text processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0089] This embodiment provides a visual text processing device, such as Figure 8 As shown, including:

[0090] An acquisition module 801 is used to acquire a target image of a current visual task and a corresponding prompt text;

[0091] The first processing module 802 is used to extract the visual features of the target image and the text features of the prompt text to obtain features to be processed;

[0092] The second processing module 803 is used to input the features to be processed into the target model, and use the language processing module in the target model and the target task processing submodule corresponding to the current visual task to process the features to be processed, so as to obtain the processing result of the current visual task.

[0093] In some optional embodiments, the target model includes multiple language processing modules and task processing modules corresponding to the language processing modules, the task processing modules include a task selection submodule, a first task processing submodule for image generation, a second task processing submodule for image understanding, and a third task processing submodule for image generation and understanding, and the task selection submodule is used to determine the target task processing submodule based on the features to be processed.

[0094] In some optional implementations, the task processing modules correspond one-to-one to the language processing modules.

[0095] In some optional implementations, a task processing module is provided between any two adjacent language processing modules.

[0096] In some optional implementations, the second processing module 803 includes:

[0097] A first feature processing unit, configured to use a language processing module to understand input features and obtain labeled task processing features;

[0098] A first selection unit is used to understand the task processing characteristics by using the task selection submodule, and determine a target task processing submodule, wherein the target task processing submodule includes a third task processing submodule, and one of the first task processing submodule and the second task processing submodule;

[0099] The second feature processing unit is used to process the task processing features using the target task processing submodule to obtain the processing result of the current visual task.

[0100] In some optional implementations, the target model further includes a result generation module, the result generation module corresponds to the visual task, and the second processing module further includes:

[0101] A second selection unit, configured to determine a target result generation module corresponding to the current visual task based on the target task processing submodule determined by the task selection submodule;

[0102] The third feature processing unit is used to use the target result generation module to process the target features obtained after being processed by multiple language processing modules and target task processing sub-modules to obtain the processing result of the current visual task.

[0103] In some optional implementations, if the current visual task is an image generation task, the target result generation module is a conditional diffusion model; and the third feature processing unit includes:

[0104] The first execution unit is used to parse the target feature through Gaussian noise built into the conditional diffusion model, obtain a visual image for editing the target image according to the prompt text, and use the visual image as the target processing result.

[0105] In some optional implementations, if the current visual task is an image understanding task, the target result generation module is a text marker; and the third feature processing unit includes:

[0106] The second execution unit is used to parse the target features through a text marker, obtain a description text for understanding the target image according to the prompt text, and use the description text as a target processing result.

[0107] In some optional embodiments, the device for training the target model includes:

[0108] A sample acquisition unit, used to acquire feature samples to be processed, wherein the feature samples to be processed are composed of visual feature samples of image samples and text feature samples of prompt text samples;

[0109] A third processing module is used to determine the loss function value corresponding to the result generation module in the process of inputting the feature sample to be processed into the initial model for model training;

[0110] The fourth processing module is used to end the model training if all loss function values ​​are less than a specified threshold, and obtain the target model according to the current parameters of the initial model.

[0111] In some optional implementations, the first processing module 802 includes:

[0112] The feature extraction unit is used to perform feature extraction processing on the target image through a preset visual encoder to obtain visual features.

[0113] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0114] The visual text processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0115] The present disclosure also provides an electronic device having the above Figure 8 The visual text processing device shown.

[0116] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present disclosure, such as Fig. 9As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.

[0117] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0118] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0119] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device 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.

[0120] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0121] The electronic device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0122] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0123] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0124] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0125] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0126] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0127] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0128] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0129] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A visual text processing method, characterized in that: The method comprises: Get the target image of the current visual task and the corresponding prompt text; Extracting visual features of the target image and text features of the prompt text to obtain features to be processed; The feature to be processed is input into the target model, and the feature to be processed is processed using the language processing module in the target model and the target task processing submodule corresponding to the current visual task to obtain the processing result of the current visual task.

2. The method according to claim 1, characterized in that: The target model includes multiple language processing modules and task processing modules corresponding to the language processing modules. The task processing modules include a task selection submodule, a first task processing submodule for image generation, a second task processing submodule for image understanding, and a third task processing submodule for image generation and understanding. The task selection submodule is used to determine the target task processing submodule based on the features to be processed.

3. The method according to claim 2, characterized in that The task processing modules correspond one to one to the language processing modules.

4. The method according to claim 3, characterized in that The task processing module is arranged between any two adjacent language processing modules.

5. The method according to claim 2, characterized in that: The processing of the to-be-processed features by using the language processing module in the target model and the target task processing submodule corresponding to the current visual task to obtain the processing result of the current visual task includes: Using the language processing module to understand input features and obtain labeled task processing features; Using the task selection submodule to understand the task processing characteristics, determine the target task processing submodule, and the target task processing submodule includes the third task processing submodule and one of the first task processing submodule and the second task processing submodule; The target task processing submodule is used to process the task processing feature to obtain a processing result of the current visual task.

6. The method according to claim 2, characterized in that The target model also includes a result generation module, and the result generation module corresponds to the visual task. The language processing module in the target model and the target task processing submodule corresponding to the current visual task are used to process the features to be processed to obtain the processing result of the current visual task, and further includes: Determine a target result generation module corresponding to the current visual task based on the target task processing submodule determined by the task selection submodule; The target result generation module is used to process the target features obtained after being processed by the multiple language processing modules and the target task processing submodules to obtain the processing result of the current visual task.

7. The method according to claim 6, characterized in that If the current visual task is an image generation task, the target result generation module is a conditional diffusion model; the target result generation module is used to process the target features obtained after being processed by the multiple language processing modules and the target task processing submodules to obtain the processing result of the current visual task, including: The target features are analyzed by Gaussian noise built into the conditional diffusion model to obtain a visual image for editing the target image according to the prompt text, and the visual image is used as the target processing result.

8. The method according to claim 6, characterized in that If the current visual task is an image understanding task, the target result generation module is a text marker; the target result generation module is used to process the target features obtained after being processed by the multiple language processing modules and the target task processing submodules to obtain the processing result of the current visual task, including: The target features are parsed by the text marker to obtain a description text for understanding the target image according to the prompt text, and the description text is used as the target processing result.

9. The method according to claim 6, characterized in that The method of training the target model includes: Acquire a feature sample to be processed, wherein the feature sample to be processed is composed of a visual feature sample of an image sample and a text feature sample of a prompt text sample; In the process of inputting the feature sample to be processed into the initial model for model training, determining the loss function value corresponding to the result generation module; If all loss function values ​​are less than the specified threshold, the model training is terminated, and the target model is obtained based on the current parameters of the initial model.

10. The method according to claim 1, characterized in that The extracting visual features of the target image comprises: The target image is subjected to feature extraction processing by a preset visual encoder to obtain the visual feature.

11. A visual text processing device, characterized in that: The device comprises: The acquisition module is used to obtain the target image of the current visual task and the corresponding prompt text; A first processing module is used to extract visual features of the target image and text features of the prompt text to obtain features to be processed; The second processing module is used to input the features to be processed into the target model, and use the language processing module in the target model and the target task processing submodule corresponding to the current visual task to process the features to be processed to obtain the processing result of the current visual task.

12. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the visual text processing method according to any one of claims 1 to 10 by executing the computer instructions.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the visual text processing method according to any one of claims 1 to 10.

14. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the visual text processing method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method, device, equipment and medium for processing visual task by using universal model

    CN115830330A

  • Text generation method based on multiple tasks, terminal equipment and readable storage medium

    CN117688170A

  • Text question and answer method, visual language model training method and related devices thereof

    CN117690144A

Cited By

  • Task execution method and device and robot

    CN119589677A

  • Visual task processing method, and method for training visual task processing model

    WO2026184405A1