Image processing method, multi-modal large model training method and related device

By predicting the expected image recognition task, extracting image features and constructing large language model prompt information, the image processing method, combined with the training of multi-modal large models, solves the problem of image recognition complexity and insufficient accuracy, and achieves efficient and accurate Image recognition effect.

CN118608923APending Publication Date: 2024-09-06BAIDU INT TECH (SHENZHEN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410700774.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing technologies have problems with insufficient recognition complexity and accuracy in image recognition and retrieval. Traditional image recognition products have difficulty processing images with multiple subjects and complex information, while AI conversational image recognition products have inaccuracies in their descriptions.

Method used

An image processing method is proposed, which extracts image features by predicting expected image recognition tasks, and builds prompt information for a large language model based on the features and tasks, inputs the model to obtain image recognition results, and combines multi-modal large model training methods to optimize The feature extraction and reasoning process improves the efficiency and accuracy of image recognition.

Benefits of technology

It achieves more efficient and accurate image recognition, can meet diverse image recognition needs, reduces large model resource consumption and delay, avoids hallucination problems, and improves the image recognition ability of the image recognition model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608923A
    Figure CN118608923A
Patent Text Reader

Abstract

The invention provides an image processing method, a multi-modal large model training method and a related device, and relates to the technical field of image processing, in particular to the technical fields of artificial intelligence, intelligent search, computer vision, large models and the like. According to the specific implementation scheme, an expected image recognition task of a target object for a to-be-processed image is predicted; under the condition that the large language model is adopted to complete the expected image recognition task, extracting image features of the to-be-processed image; building prompt information of a large language model based on the image features of the to-be-processed image and the expected image recognition task; and inputting prompt information into the large language model to obtain an image recognition result of the to-be-processed image. According to the image recognition method and device, the image recognition efficiency and accuracy can be improved, and diversified image recognition requirements can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to the technical fields of artificial intelligence, intelligent search, computer vision, large models, etc. Background Art

[0002] Computer image processing is an important branch of artificial intelligence. Image data has the characteristics of high latitude and is easily affected by changes and noise. These characteristics bring some challenges to computer image recognition. With the development of computer technology, the image recognition task is not limited to identifying an object in the image, and people have put forward higher requirements for computer image recognition capabilities. Summary of the invention

[0003] The present disclosure provides an image processing method, a training method for a multimodal large model, and related devices.

[0004] According to one aspect of the present disclosure, there is provided an image processing method, comprising:

[0005] Predict the target object's expected image recognition task for the image to be processed;

[0006] When a large language model is used to complete the desired image recognition task, image features of the image to be processed are extracted;

[0007] Prompt information for building a large language model based on the image features of the image to be processed and the desired image recognition task;

[0008] The prompt information is input into the large language model to obtain the image recognition result of the image to be processed.

[0009] According to another aspect of the present disclosure, a method for training a multimodal large model is provided, wherein the multimodal large model includes a feature extraction model and a large language model, and the method includes:

[0010] Inputting the first sample image into the feature extraction model to be optimized to obtain image features of the first sample image;

[0011] Based on the image features of the first sample image and the target image recognition task, construct prompt information of the large language model;

[0012] Input the prompt information into the large language model to obtain prediction information corresponding to the first sample image;

[0013] Comparing the predicted information with the annotation information of the first sample image corresponding to the target image recognition task to determine a first loss value;

[0014] The feature extraction model to be optimized is adjusted based on the first loss value, and a large multimodal model is obtained when the convergence condition is met.

[0015] According to another aspect of the present disclosure, there is provided an image processing apparatus, comprising:

[0016] A first prediction unit, used to predict the expected image recognition task of the target object for the image to be processed;

[0017] A first extraction unit is used to extract image features of the image to be processed when a large language model is used to complete the desired image recognition task;

[0018] A first construction unit is used to construct prompt information of a large language model based on image features of the image to be processed and the desired image recognition task;

[0019] The processing unit is used to input the prompt information into the large language model to obtain the image recognition result of the image to be processed.

[0020] According to another aspect of the present disclosure, a training device for a multimodal large model is provided, wherein the multimodal large model includes a feature extraction model and a large language model, and the device includes:

[0021] A second extraction unit, used for inputting the first sample image into the feature extraction model to be optimized to obtain image features of the first sample image;

[0022] A second construction unit is used to construct prompt information of a large language model based on the image features of the first sample image and the target image recognition task;

[0023] A second prediction unit, used for inputting the prompt information into the large language model to obtain prediction information corresponding to the first sample image;

[0024] A comparison unit, configured to compare the prediction information with the annotation information of the first sample image corresponding to the target image recognition task, and determine a first loss value;

[0025] The optimization unit is used to adjust the feature extraction model to be optimized based on the first loss value, and obtain a multimodal large model when the convergence condition is met.

[0026] According to another aspect of the present disclosure, there is provided an electronic device, comprising:

[0027] at least one processor; and

[0028] a memory communicatively connected to the at least one processor; wherein,

[0029] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any method in the embodiments of the present disclosure.

[0030] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any method according to the embodiments of the present disclosure.

[0031] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.

[0032] In the entire process of the disclosed embodiment, the desired image recognition task is taken as the guide, and the image content is gradually digested and understood through feature extraction and large model reasoning, and finally the image recognition task is completed and a suitable image recognition result is given. Therefore, the solution can improve the efficiency and accuracy of image recognition to meet the diverse image recognition needs.

[0033] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0035] Figure 1 is a flowchart of an image processing method according to an embodiment of the present disclosure;

[0036] Figure 2 is a flowchart of a method for training a multimodal large model according to an embodiment of the present disclosure;

[0037] Figure 3 is a schematic diagram of training a first image encoder to be optimized according to an embodiment of the present disclosure;

[0038] Figure 4 is a schematic diagram of training a second image encoder to be optimized according to an embodiment of the present disclosure;

[0039] Figure 5 is a schematic diagram of obtaining image features according to an embodiment of the present disclosure;

[0040] Figure 6 is a schematic diagram of the overall framework of an image processing method according to an embodiment of the present disclosure;

[0041] Figure 7 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure;

[0042] Figure 8 is a structural schematic diagram of a training device for a multimodal large model according to an embodiment of the present disclosure;

[0043] Fig. 9 It is a block diagram of an electronic device used to implement the image processing method and multi-modal large model training method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0044] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0045] The terms "first", "second", etc. in this disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or precedence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, including a series of steps or units. The method, system, product or device is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0046] In the relevant technology, there are two types of products for image recognition and retrieval: traditional image recognition products and AI (Artificial Intelligence) dialogue image recognition products. The complexity of traditional image recognition products is lower than that of AI dialogue image recognition products.

[0047] Among them, traditional image recognition products mainly recognize images through retrieval technology, such as retrieving similar images, identifying the categories of objects in images, and recognizing text in images. When faced with images with multiple subjects and complex information, traditional image recognition products can often only recognize part of the subject and cannot cover the overall image information.

[0048] AI conversational image recognition products use generative technology to understand images, and the output is generally one or several paragraphs. Although AI conversational image recognition products can process more complex images than traditional image recognition products, there are also cases where the description is inaccurate.

[0049] In view of this, in order to complete the image recognition task more accurately and improve the image recognition quality, the present disclosure proposes an image processing method, such as Figure 1 As shown, this may include:

[0050] S101, predicting the expected image recognition task of the target object for the image to be processed.

[0051] Among them, the expected image recognition task represents the image recognition task that the target object most expects to complete for the image to be processed. During implementation, the probability of each candidate image recognition task can be predicted for the image to be processed, and the image recognition task with the highest probability can be selected as the expected image recognition task. In other embodiments, an intention recognition model for the image can also be used to analyze the target object's image recognition needs for the image to be processed, and obtain the expected image recognition task.

[0052] For example, when the image to be processed is a question, the expected image recognition task of the image to be processed is a problem-solving type, and when the image to be processed includes plants, the expected image recognition task is a cognitive type. Of course, it is understandable that the same image to be processed may correspond to multiple expected image recognition tasks. The specific image recognition task can be determined based on actual conditions, and the embodiments of the present disclosure do not limit this.

[0053] S102, extracting image features of the image to be processed when a large language model is used to complete the desired image recognition task.

[0054] Among them, Large Language Models (LLMs) refer to a specific type of large models that can be used to process feature information.

[0055] The large language model has good reasoning ability and small sample learning ability. The large language model can understand the model size is large or can be trained on a large number of samples. Based on the large language model, the image content can be accurately understood to facilitate the completion of the image recognition task.

[0056] The disclosed embodiments may provide a general feature extraction model to extract image features of an image to be processed.

[0057] In some other embodiments, the image features may be extracted based on the expected image recognition task. For example, the expected image recognition task is encoded as a feature vector, which is then added to the image to be processed and image features are extracted therefrom.

[0058] S103, constructing prompt information of a large language model based on the image features of the image to be processed and the expected image recognition task.

[0059] It can be understood that the prompt information at least includes the image features of the image to be processed and the expected image recognition task. The image features of the image to be processed are used by the large language model to understand the image content, and the expected image recognition task is used by the large language model to understand its own task requirements.

[0060] The prompt information can also include some examples for the large language model to refer to for reasoning.

[0061] In addition, the prompt information may also include a chain of ideas, which guides the large language model to complete reasoning by providing some reasoning processes.

[0062] S104, inputting the prompt information into the large language model to obtain the image recognition result of the image to be processed.

[0063] In the disclosed embodiment, firstly, by predicting the expected image recognition task, the processing direction of the image to be processed can be clarified to meet the image recognition needs of the target object. On this basis, by further extracting image features, the large language model can better understand the image content on this basis and complete the reasoning task. In the whole process, guided by the expected image recognition task, through feature extraction and large model reasoning, the image content is gradually digested and understood, and finally the image recognition task is completed to give a suitable image recognition result. Therefore, this solution can improve the efficiency and accuracy of image recognition to meet diverse image recognition needs.

[0064] In the disclosed embodiment, the modules that complete image feature extraction and large language model reasoning capabilities can be collectively referred to as a multimodal large model. That is, the multimodal large model is used to complete the operations of S102 and S103.

[0065] In addition, in the embodiments of the present disclosure, it is not limited to using a multimodal large model to complete the image recognition task. In order to balance the image recognition efficiency and computing power complexity, the embodiments of the present disclosure also appropriately introduce traditional image recognition products to complete the image recognition task. Moreover, when traditional image recognition products cannot effectively complete the image recognition task, a multimodal large model can also be used to assist in completing the image recognition task.

[0066] Whether it is a multimodal large model or a traditional image recognition product, they are all summarized in the model collection. For the image to be processed, you can first filter out the appropriate model from the model collection to complete the image recognition task.

[0067] For ease of understanding, the above aspects will be explained below.

[0068] 1) Select the appropriate model for the image to be processed

[0069] In some embodiments, the expected image recognition task can be determined first, and then a suitable model can be screened for the image to be processed based on the expected image recognition task. For example, predicting the expected image recognition task of the target object for the image to be processed can be implemented as follows: processing the image to be processed based on the intention recognition technology to obtain the expected image recognition task of the target object for the image to be processed. The intention recognition technology is implemented using a neural network model with a relatively small scale relative to the large model. For example, an object frame of at least one object to be recognized in the image to be processed and a recognition result (such as a classification result) of the object frame can be determined based on a region determination model, and the object frame represents the area where the valid object is located in the image to be processed; based on the recognition result of the object frame, the expected image recognition task of the image to be processed can be further determined.

[0070] The region determination model may be a regional convolutional neural network (Region-CNN, R-CNN), which includes a first network, a second network, and a third network. The first network is used to extract feature information of an object to be identified in an image to be processed; the second network is used to determine a target region of an object to be identified; and the third network is used to identify an object to be identified in a region.

[0071] In some embodiments, the desired image recognition task of the image to be processed can be determined based on the recognition result of the object to be processed and the association mapping table. The association mapping table includes the correspondence between the recognition result and the image recognition task. In some possible implementations, the association mapping table can be shown in Table 1 below:

[0072] Table 1

[0073]

[0074]

[0075] The association mapping table in Table 1 is only an example and can be updated based on actual conditions during implementation, which is not limited in the embodiments of the present disclosure.

[0076] When the expected image recognition task is determined, the model type corresponding to the expected image recognition task may be further determined. In some embodiments, the method may be implemented as follows: searching a mapping relationship table between the expected image recognition task and the adaptation model to obtain the model type corresponding to the expected image recognition task.

[0077] During implementation, the mapping relationship table between the expected image recognition task and the adaptation model can be in the same table as the association mapping table between the recognition result and the image recognition task, or two tables can be used, which is not limited in the embodiments of the present disclosure.

[0078] In the disclosed embodiment, based on the mapping relationship table between the expected image recognition task and the adaptation model, when the expected image recognition task is obtained, the model adapted to the task can be quickly obtained. This method is simple to operate and easy to implement.

[0079] In some embodiments, specifically, the mapping relationship table between the expected image recognition task and the adaptation model may include:

[0080] (1) When the expected image recognition task is to recognize the image subject, the corresponding model type is a cognitive model;

[0081] (2) When the desired image recognition task is to search for images, the corresponding model type is the image search model;

[0082] (3) When the expected image recognition task is to recognize the text in the image, the corresponding model type is the character recognition problem-solving model; that is, the character recognition problem-solving model is used to complete the character recognition and even further complete the problem-solving operation;

[0083] (4) When the expected image recognition task is to describe complex image content, the corresponding model type is a large language model (that is, a multimodal large model is used to complete the image recognition task). For example, in the case of multiple subjects, it is difficult to determine the image recognition needs of the target object. A multimodal large model can be used to further clarify the needs of the target object and clarify the final expected image recognition task.

[0084] Among them, the mapping relationship table between the expected image recognition task and the adaptation model can be sorted as shown in Table 2:

[0085] Table 2

[0086]

[0087] For example, when the recognition result is text, a question, etc., the image recognition task is expected to be text recognition, and the OCR model (Optical Character Recognition) can be used as a character recognition and problem-solving model.

[0088] When the recognition result is a plant, animal, etc., the image recognition task is expected to be to recognize the image subject. The image recognition search model in the image search tool can be used as a cognitive model to introduce the basic information of the image subject in the image to be processed through the cognitive model. For example, introduce the name, characteristics, distribution area, efficacy, etc. of the plant.

[0089] When the recognition result is a material, a face, a product, etc., the VGG model (Visual Geometry Group) can be used as the image search model. For example, the material can be a poster, a cartoon image, etc.

[0090] When the recognition result is multiple subjects or the visual picture is complex, that is, the image subject cannot be determined, the expected image recognition task can be to describe the complex image content, and a multimodal large model can be used as an image recognition model.

[0091] In the disclosed embodiment, the image to be processed is processed using a model corresponding to the desired image recognition task, which can ensure the accuracy and efficiency of image processing and reduce resource consumption and delay caused by calling a large model.

[0092] In the disclosed embodiments, model types other than the multimodal large model can be collectively referred to as image recognition models (i.e., traditional image recognition product models). The scale of the image recognition model is smaller than the large language model, and different image recognition tasks correspond to different image recognition models.

[0093] In some embodiments, when the model type is an image recognition model that matches the desired image recognition task, the image recognition model is used to recognize the image to be processed; when the image recognition model fails to recognize the image, it is determined to use a large language model to complete the desired image recognition task.

[0094] During implementation, the aforementioned literacy problem-solving model, cognitive model, and image search model are all smaller in scale than the large language model, and all correspond to different image recognition tasks.

[0095] Among them, the failure of the image recognition model to recognize an image can be understood as the content output by the image recognition model not meeting the expected requirements of the target object, or it can be understood as the image recognition model not outputting any content. For example, the cognitive model failed to complete the word guessing task and did not obtain the corresponding word description.

[0096] Although the large language model can handle a variety of image recognition tasks, the large language model is large in size and may occupy a large amount of computing resources during use, and may also produce hallucinations. Therefore, in the embodiment of the present disclosure, when the desired image recognition task is determined, a smaller image recognition model is used to process it first. When the image recognition model cannot meet the requirements of the target object, the large language model is used again, which can save resources while ensuring accuracy, and avoid the hallucination problem of the large model to a certain extent.

[0097] In addition to the above-mentioned situation where a large model is applicable to complete the expected image recognition task, it can be understood that when the model type is a large language model, it is determined to use a large language model to complete the expected image recognition task.

[0098] In the disclosed embodiment, the model type corresponding to the desired image recognition task is determined first, and when the model type is a large language model, the large language model is determined to be used to complete the desired image recognition task. Based on this approach, the advantages of the large model can be used to complete complex image recognition tasks.

[0099] Based on the previous description, we can see that the multimodal large model gradually understands the image to be processed through feature extraction and further reasoning of the large language model to obtain appropriate image recognition results.

[0100] In order to improve the image recognition capability of a large multimodal model, an embodiment of the present disclosure provides an optimization training method for a large multimodal model.

[0101] 2) Training methods for large multimodal models

[0102] As described above, the multimodal large model includes a feature extraction model and a large language model, and its training method is as follows: Figure 2 As shown, including the following:

[0103] S201, inputting a first sample image into a feature extraction model to be optimized to obtain image features of the first sample image.

[0104] The feature extraction module to be optimized is used to extract image features including global features and fine-grained features of the first sample image.

[0105] Among them, the global features of the first sample image are used to represent the overall features of the first sample image, and the fine-grained features of the first sample image are used to represent the features of the local area of ​​the first sample image, which are used as supplementary content to the global features, so that the finally generated image features are more suitable for completing the image recognition task.

[0106] S202, constructing prompt information of a large language model based on image features of the first sample image and the target image recognition task.

[0107] Similar to the above description, it can be understood that the prompt information includes at least the image features of the first sample image and the target image recognition task. The image features of the first sample image are used by the large language model to understand the image content, and the target image recognition task is used by the large language model to understand its own task requirements.

[0108] The prompt information can also include some examples for the large language model to refer to for reasoning.

[0109] In addition, the prompt information may also include a chain of ideas, which guides the large language model to complete reasoning by providing some reasoning processes.

[0110] S203: Input the prompt information into the large language model to obtain prediction information corresponding to the first sample image.

[0111] S204: Compare the predicted information with the annotation information of the first sample image corresponding to the target image recognition task to determine a first loss value.

[0112] The annotation information corresponds to the image recognition task, and different image recognition tasks have different annotation information. In this way, the same sample image can be used to train different image recognition tasks.

[0113] For example, when the first sample image includes a table and a book on the table, its annotation information may be that there is a book on the table. The disclosed embodiment can achieve refined image description. For example, not only can it be described that there is a book on the table, but also the type of the book can be described, such as that it is a Chinese book, and even the publisher of the Chinese book, the main knowledge points, etc. can be further described.

[0114] For another example, for a skin care product, the refined description in the embodiments of the present disclosure is not limited to describing a bottle of skin care product, but can further identify refined information such as the brand, main ingredients, main effects, etc. of the skin care product.

[0115] Refined image descriptions are obtained by training a large multimodal model, thereby improving the image recognition capabilities of the large multimodal model.

[0116] S205, adjusting the feature extraction model to be optimized based on the first loss value, and obtaining a multimodal large model when a convergence condition is met.

[0117] That is, the model parameters of the large language model are fixed, and only the parameters of the feature extraction model are adjusted, thereby obtaining the required multimodal large model.

[0118] The convergence condition may be that the first loss value tends to be stable and / or a preset number of iterations is met.

[0119] In the disclosed embodiment, by extracting image features, the large language model can better understand the image content on this basis and complete the reasoning task. In the entire process, guided by the target image recognition task, through feature extraction and large model reasoning, the image content is gradually digested and understood, and finally the image recognition task is completed, guiding the multimodal large model to give appropriate image recognition results. Therefore, the multimodal large model trained by this solution can improve the efficiency and accuracy of image recognition to meet the diverse image recognition needs.

[0120] In some embodiments, in order to improve the image understanding ability, the feature extraction model to be optimized includes a feature extraction module to be optimized and a multimodal fusion module to be optimized. On this basis, extracting the image features of the first sample image can be implemented as follows:

[0121] Step B1: input the first sample image into the feature extraction module to be optimized to obtain the global features and fine-grained features of the first sample image.

[0122] In some embodiments, extracting the global features and fine-grained features of the first sample image may be implemented as steps B11 and B12:

[0123] Step B11, inputting the first sample image into the first image encoder to be optimized in the feature extraction module to be optimized to obtain the global feature.

[0124] The first image encoder to be optimized is obtained based on a pre-trained model, and then fine-tuned to make it suitable for a multimodal large model. During implementation, the pre-trained model is an initial image-text comparison model, which is pre-trained by contrastive learning of image-text pairs. The model includes an initial first image encoder and an initial text encoder, and the pre-training method includes steps C1 to C3:

[0125] Step C1, input the first sample pair into the initial image-text contrast model to obtain the global features of the second sample image in the first sample pair output by the initial first image encoder in the initial image-text contrast model, and the text features of the text information in the first sample pair output by the initial text encoder in the image-text contrast model.

[0126] The initial image-text contrast model may be CLIP (Contrastive Language-Image Pre-Training).

[0127] Step C2: determining a first contrastive learning loss based on the global features of the second sample image and the text features of the text information.

[0128] Step C3, adjusting the model parameters of the initial image-text contrast model based on the first contrastive learning loss, and determining the initial first image encoder as the first image encoder to be optimized when a convergence condition is met.

[0129] The convergence condition may be that the first contrastive learning loss tends to be stable, and / or the iteration meets a preset number of times.

[0130] The model training process is as follows Figure 3 As shown, the second sample image in the first sample pair is input into the initial first image encoder in the initial image-text contrast model to obtain the global features of the second sample image; the text information in the first sample pair is input into the initial text encoder to obtain the text features; based on the gap information between the text features and the global features, the first contrast learning loss is determined; based on the first contrast learning loss, the model parameters of the initial image-text contrast model are adjusted, and when the convergence conditions are met, the initial first image encoder is determined as the first image encoder to be optimized. The sample pairs required for pre-training may include positive sample pairs and negative sample pairs. Thus, when the first sample pair is a positive sample pair, the text information is used to describe the global situation of the second sample image, so that the first image encoder to be optimized can learn the global features in the image. Negative sample pairs can be constructed using mismatched image-text pairs to train the initial image-text contrast model.

[0131] It is understandable that when the scale of the initial first image encoder is large, the scale of the initial first image encoder can be reduced through distillation technology to improve the image recognition efficiency of the multimodal large model.

[0132] In an embodiment of the present disclosure, a first sample pair including a sample image and text information is used to train an image-text comparison model. Based on this method, the first image encoder in the image-text comparison model can extract global features, and then fine-tuned using the method of the present disclosure to obtain a first image encoder suitable for image recognition tasks.

[0133] Step B12: input the first sample image into the second image encoder to be optimized of the feature extraction module to be optimized to obtain fine-grained features.

[0134] The second image encoder to be optimized is also obtained through pre-training. In this case, a computer vision model including two image encoders can be used to complete the pre-training task. In this pre-training task, positive sample pairs and negative sample pairs can be constructed, and the two images in the positive sample pair are similar. The two images in the negative sample pair are not similar. During implementation, the second image encoder to be optimized is obtained based on the following method:

[0135] Step D1, input the third sample image in the second sample pair into the initial second image encoder of the initial image processing model, and input the fourth sample image in the second sample pair into the initial third image encoder of the initial image processing model, to obtain the fifth image feature output by the initial second image encoder, and the sixth image feature output by the initial third image encoder.

[0136] The second sample pair is a general term for training samples, and may include a positive sample pair or a negative sample pair.

[0137] During implementation, a positive sample pair can be obtained based on the following method, including: performing a preset process on the initial sample image to obtain a remodeled sample image; wherein the preset process can be at least one of the following processes: cropping, color conversion, occlusion, rotation, etc. Thus, the remodeled sample image and the initial sample image are constructed as a positive sample pair. It can be understood that different remodeled sample images obtained by the preset process of the same initial sample image can also construct a positive sample pair. For example, two remodeled sample images obtained by rotating the initial sample image by 30 degrees and 90 degrees respectively can construct a positive sample pair.

[0138] When the second sample pair is a negative sample pair, the third sample image and the fourth sample image may be two different images, or may be images obtained by performing preset processing on two different images, which is not limited in the embodiments of the present disclosure.

[0139] Step D2, determining a second contrastive learning loss based on the fifth image feature and the sixth image feature;

[0140] Step D3, adjusting the model parameters of the initial image processing model based on the second contrastive learning loss, and determining the initial second image encoder as the second image encoder to be optimized when a convergence condition is met;

[0141] Among them, the second contrastive learning loss is used to reduce the gap between positive sample pairs and increase the gap between negative sample pairs.

[0142] The training process of the model is as follows Figure 4 As shown, the third sample image of the second sample pair is input into the initial second image encoder of the initial image processing model to obtain the fifth image feature output by the initial second image encoder; and the fourth sample image of the second sample pair is input into the initial third image encoder of the initial image processing model, as well as the sixth image feature output by the initial third image encoder; the second contrastive learning loss is determined based on the fifth image feature and the sixth image feature; the model parameters of the initial image processing model are adjusted based on the second contrastive learning loss, and the initial second image encoder is determined as the second image encoder to be optimized when the convergence condition is met. Thus, pre-training can be achieved through image self-distillation technology, and then the initial second image encoder obtained through training is selected for fine-tuning.

[0143] Similarly, it should be noted that the size of the second image encoder can also be reduced through distillation technology.

[0144] In the disclosed embodiment, a dual-pass image encoder is adopted so that the final second image encoder is more focused on the image details, so as to train an encoder capable of extracting fine-grained features of the image.

[0145] It should be noted that the execution order of the aforementioned step B11 and step B12 is not limited.

[0146] In the disclosed embodiment, based on the pre-trained first image encoder to be optimized in the feature extraction module to be optimized and the second image encoder to be optimized in the feature extraction module to be optimized, global features and local features can be extracted respectively. The two image encoders perform their respective functions and can accurately obtain image features suitable for image recognition tasks.

[0147] After obtaining the global features and fine-grained features, in order to adapt to the reasoning requirements of the large language model and improve the reasoning ability of the large language model, in the embodiment of the present disclosure, in step B2, the global features and fine-grained features are input into the multimodal fusion module to be optimized to obtain the image features of the first sample image.

[0148] Among them, the multimodal fusion module to be optimized is used to map global features and fine-grained features into image features that can be processed by the large language model.

[0149] In the disclosed embodiment, global features and fine-grained features are mapped based on the multimodal fusion module to be optimized to obtain image features that are easier for the large model to process and understand, thereby improving the image recognition capability of the multimodal large model.

[0150] During implementation, the global features and fine-grained features are input into the multimodal fusion module to be optimized to obtain image features of the first sample image, including:

[0151] Step E1, inputting the global feature into the self-attention module to be optimized of the multimodal fusion module to be optimized to obtain the third feature.

[0152] Step E2, inputting the fine-grained features into the convolution module to be optimized of the multimodal fusion module to be optimized to obtain the fourth feature.

[0153] It should be noted that the execution order of steps E1 and E2 is not limited.

[0154] Step E3: fusing the third feature and the fourth feature to obtain the image feature of the first sample image.

[0155] In one embodiment, fusing the third feature and the fourth feature to obtain the image feature of the first sample image can be implemented as follows: splicing the third feature and the fourth feature to obtain the image feature of the first sample image, so as to retain more original feature information for inference by the large language model. The size of the third feature is smaller than the size of the global feature, and the size of the fourth feature is smaller than the size of the fine-grained feature. Thus, through the multimodal fusion module, not only can the extracted features be converted to adapt to the large language model, but also key features can be further extracted for use by the large language model.

[0156] In the disclosed embodiment, the global features are processed using the self-attention module to be optimized of the multimodal fusion module to be optimized to obtain the third feature, and the fine-grained features are processed using the convolution module to be optimized of the multimodal fusion module to be optimized to obtain the fourth feature. The corresponding channel is automatically called for processing each feature, and then fused to obtain image features that can be processed by the large model. The gradual image processing can enable the trained multimodal large model to better complete the image recognition task.

[0157] It can be understood that during the training of the multimodal large model, the parameters of the large language model are fixed, and the training is completed by adjusting the model parameters of the first image encoder to be optimized, the second image encoder to be optimized, the self-attention module and the convolution module of the feature extraction model.

[0158] 3) Complete image recognition tasks based on the trained multimodal large model

[0159] In some embodiments, the desired image recognition task is completed based on the aforementioned trained multimodal large model. As described above, the multimodal large model includes a feature extraction module, a multimodal fusion module, and a large language model. The feature extraction module and the multimodal fusion module are used to extract image features of the image to be processed, which can be specifically implemented as follows:

[0160] Step F1, inputting the image to be processed into a feature extraction module to obtain global features and fine-grained features of the image to be processed;

[0161] Consistent with the training process, the image to be processed is input into the feature extraction module to obtain the global features and fine-grained features of the image to be processed, which can be implemented as follows:

[0162] Step F11, inputting the image to be processed into the first image encoder in the feature extraction module to obtain global features.

[0163] Step F12, inputting the image to be processed into the second image encoder of the feature extraction module to obtain fine-grained features.

[0164] In the disclosed embodiment, the global features and fine-grained features of the image to be processed are obtained based on two channels. The two features are combined to fully understand the image content and improve the image recognition ability of the large model.

[0165] Step F2, inputting the global features and fine-grained features into a multimodal fusion module to obtain image features of the image to be processed.

[0166] In the disclosed embodiment, the image features obtained in this way can not only characterize the image to be processed, but also adapt to the large language model, thereby improving the image recognition ability and helping to obtain accurate image recognition results.

[0167] In some embodiments, consistent with the training process, global features and fine-grained features are input into a multimodal fusion module to obtain image features of the image to be processed, which can be implemented as follows:

[0168] Step F21, input the global feature into the self-attention module of the multimodal fusion module to obtain the first feature.

[0169] Step F22, input the fine-grained features into the convolution module of the multimodal fusion module to obtain the second features.

[0170] Step F23, fusing the first feature and the second feature to obtain the image feature of the image to be processed.

[0171] In the disclosed embodiment, the global features and fine-grained features are processed using corresponding channels respectively and then fused. While ensuring the integrity of the feature data, the final image features can better represent the key features of the original image to be processed, thereby facilitating reasoning of the large model and improving image recognition capabilities.

[0172] After obtaining the image features of the image to be processed, the prompt information of the large language model can be constructed to facilitate the large language model to perform inference and obtain the image recognition result. It can be implemented as follows: splicing the image features of the image to be processed and the expected image recognition task based on a preset order to obtain the prompt information.

[0173] For example, the preset order is image feature of the image to be processed-expected image recognition task; where the image feature of the image to be processed is A, and the expected image recognition task is task A, then the prompt information may be "A-Task A".

[0174] In the embodiment of the present disclosure, when it is necessary to use a large model to obtain the image recognition result of the image to be processed, the entire architecture diagram is as follows: Figure 5 As shown. The multimodal large model obtained by the above training may include a feature extraction module, a multimodal fusion module and a large language model. Among them, the feature extraction module includes a first image encoder and a second image encoder; the multimodal fusion module includes a self-attention module and a convolution module. When the input is an image to be processed, the first image encoder is used to extract the global features of the image to be processed, and the second image encoder is used to extract the fine-grained features of the image to be processed. The global feature is input into the self-attention module of the multimodal fusion module to obtain the first feature; and the fine-grained feature is input into the convolution module of the multimodal fusion module to obtain the second feature. The first feature and the second feature are fused to obtain the image feature of the image to be processed. Prompt information is constructed based on the image feature and the expected image recognition task, and input into the large language model; the prompt information is input into the large language model to obtain the image recognition result of the image to be processed.

[0175] In addition, the construction prompt information can also be: obtaining description information of the image to be processed; and constructing prompt information of a large language model based on image features, expected image recognition tasks, and description information.

[0176] Wherein, obtaining the description information of the image to be processed may be implemented as follows: processing the image to be processed based on the generation model to obtain the description information of the image to be processed.

[0177] Among them, the generation model can be a small image-text generation model, the purpose of which is to extract valuable text description information from the image to be processed.

[0178] In summary, the overall architecture of the embodiment of the present disclosure is as follows: Figure 6As shown, the image to be processed is processed based on the intention recognition technology to obtain the target object's expected image recognition task for the image to be processed; when the expected image recognition task is used to recognize the image subject, the corresponding model type is a cognitive model; when the expected image recognition task is used to search for images, the corresponding model type is an image search model; when the expected image recognition task is used to recognize text, the corresponding model type is a character recognition and problem-solving model; when the expected image recognition task is to describe the complex image content (that is, in the case of unknown demand type), the corresponding model type is a multimodal large model. The corresponding model is used to obtain the image recognition result.

[0179] Based on similar technical concepts, an image processing device 700 is also provided in the embodiment of the present disclosure. Figure 7 As shown, including:

[0180] The first prediction unit 701 is used to predict the expected image recognition task of the target object for the image to be processed;

[0181] A first extraction unit 702 is used to extract image features of the image to be processed when a large language model is used to complete the desired image recognition task;

[0182] A first construction unit 703, configured to construct prompt information of a large language model based on image features of the image to be processed and a desired image recognition task;

[0183] The processing unit 704 is used to input the prompt information into the large language model to obtain the image recognition result of the image to be processed.

[0184] In some embodiments, the first extraction unit comprises:

[0185] A first extraction subunit is used to input the image to be processed into a feature extraction module to obtain global features and fine-grained features of the image to be processed;

[0186] The first fusion subunit is used to input the global features and the fine-grained features into the multimodal fusion module to obtain the image features of the image to be processed.

[0187] In some embodiments, the first extraction subunit is configured to:

[0188] Inputting the image to be processed into the first image encoder in the feature extraction module to obtain global features; and

[0189] The image to be processed is input into the second image encoder of the feature extraction module to obtain fine-grained features.

[0190] In some embodiments, the first fusion subunit is used to:

[0191] Input the global feature into the self-attention module of the multimodal fusion module to obtain the first feature; and,

[0192] The fine-grained features are input into the convolution module of the multimodal fusion module to obtain the second features;

[0193] The first feature and the second feature are fused to obtain the image feature of the image to be processed.

[0194] In some embodiments, the method further includes a first determining unit configured to:

[0195] Determine the model type corresponding to the desired image recognition task;

[0196] When the model type is a large language model, it is determined that the large language model is used to complete the expected image recognition task.

[0197] In some embodiments, the method further includes a second determining unit configured to:

[0198] When the model type is a picture recognition model that matches the expected picture recognition task, the picture recognition model is used to recognize the image to be processed; the scale of the picture recognition model is smaller than the large language model;

[0199] When the image recognition model fails to recognize an image, it is determined that a large language model is used to complete the desired image recognition task.

[0200] In some embodiments, the first determination unit is used to search for a mapping relationship table between the expected image recognition task and the adaptation model to obtain the model type corresponding to the expected image recognition task.

[0201] In some embodiments, when the image recognition task is expected to be used to recognize the image subject, the corresponding model type is a cognitive model;

[0202] When the image recognition task is expected to be used for searching images, the corresponding model type is the image search model;

[0203] When the expected image recognition task is to recognize the text in the image, the corresponding model type is the character recognition problem-solving model;

[0204] When the image recognition task is expected to be a description of complex image content by the user, the corresponding model type is a large language model.

[0205] Based on similar technical concepts, the present disclosure also provides a multi-modal large model training device 800, such as Figure 8 As shown, the multimodal large model includes a feature extraction model and a large language model, and the device includes:

[0206] The second extraction unit 801 is used to input the first sample image into the feature extraction model to be optimized to obtain image features of the first sample image;

[0207] A second construction unit 802 is used to construct prompt information of a large language model based on the image features of the first sample image and the target image recognition task;

[0208] The second prediction unit 803 is used to input the prompt information into the large language model to obtain prediction information corresponding to the first sample image;

[0209] A comparing unit 804 is used to compare the prediction information with the annotation information of the first sample image corresponding to the target image recognition task to determine a first loss value;

[0210] The optimization unit 805 is used to adjust the feature extraction model to be optimized based on the first loss value, and obtain a multimodal large model when the convergence condition is met.

[0211] In some embodiments, the feature extraction model to be optimized includes a feature extraction module to be optimized and a multimodal fusion module to be optimized, and the second extraction unit includes:

[0212] A second extraction subunit is used to input the first sample image into the feature extraction module to be optimized to obtain the global features and fine-grained features of the first sample image;

[0213] The second fusion subunit is used to input the global features and the fine-grained features into the multimodal fusion module to be optimized to obtain the image features of the first sample image.

[0214] In some embodiments, the second extraction subunit is configured to:

[0215] Inputting the first sample image into the first image encoder to be optimized in the feature extraction module to be optimized to obtain global features; and

[0216] The first sample image is input into the second image encoder to be optimized of the feature extraction module to be optimized to obtain fine-grained features.

[0217] In some embodiments, the second fusion subunit is used to:

[0218] Inputting the global feature into the self-attention module to be optimized of the multimodal fusion module to be optimized to obtain the third feature; and

[0219] Inputting the fine-grained features into the convolution module to be optimized of the multimodal fusion module to be optimized to obtain the fourth feature;

[0220] The third feature and the fourth feature are fused to obtain the image feature of the first sample image.

[0221] In some embodiments, the system further includes a first pre-training unit for:

[0222] Inputting the first sample pair into an initial image-text comparison model, obtaining global features of the second sample image in the first sample pair output by an initial first image encoder in the initial image-text comparison model, and text features of text information in the first sample pair output by an initial text encoder in the image-text comparison model;

[0223] Determining a first contrastive learning loss based on the global features of the second sample image and the text features of the text information;

[0224] The model parameters of the initial image-text contrast model are adjusted based on the first contrast learning loss, and when a convergence condition is met, the initial first image encoder is determined as the first image encoder to be optimized.

[0225] In some embodiments, the system further includes a second pre-training unit for:

[0226] Inputting the third sample image in the second sample pair into the initial second image encoder of the initial image processing model, and inputting the fourth sample image in the second sample pair into the initial third image encoder of the initial image processing model, to obtain a fifth image feature output by the initial second image encoder, and a sixth image feature output by the initial third image encoder;

[0227] determining a second contrastive learning loss based on the fifth image feature and the sixth image feature;

[0228] adjusting the model parameters of the initial image processing model based on the second contrastive learning loss, and determining the initial second image encoder as the second image encoder to be optimized when a convergence condition is met;

[0229] Among them, the second contrastive learning loss is used to reduce the gap between positive sample pairs and increase the gap between negative sample pairs.

[0230] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.

[0231] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0232] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0233] Fig. 9A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0234] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0235] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0236] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as image processing methods\training methods of multimodal large models. For example, in some embodiments, the image processing method\training method of multimodal large models may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the image processing method\training method of the multimodal large model described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute the image processing method\multimodal large model training method in any other appropriate manner (for example, by means of firmware).

[0237] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0238] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0239] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0240] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0241] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0242] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0243] Based on the aforementioned electronic device, the present disclosure also provides a vehicle, which may include electronic devices, and may also include communication components, a display screen for realizing a human-machine interface, and an information collection device for collecting surrounding environment information, etc. The communication components, the display screen, the information collection device and the electronic device are communicatively connected.

[0244] According to the embodiments of the present disclosure, the electronic device may be integrated with the communication component, the display screen and the information collection device, or may be separately provided with the communication component, the display screen and the information collection device.

[0245] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0246] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. An image processing method, comprising: Predict the target object's expected image recognition task for the image to be processed; In the case of using a large language model to complete the desired image recognition task, extracting image features of the image to be processed; Prompt information for constructing the large language model based on the image features of the image to be processed and the desired image recognition task; The prompt information is input into the large language model to obtain an image recognition result of the image to be processed.

2. The method according to claim 1, wherein: The step of extracting image features of the image to be processed comprises: Inputting the image to be processed into a feature extraction module to obtain global features and fine-grained features of the image to be processed; The global features and the fine-grained features are input into a multimodal fusion module to obtain image features of the image to be processed.

3. The method according to claim 2, wherein: The step of inputting the image to be processed into a feature extraction module to obtain global features and fine-grained features of the image to be processed includes: Inputting the image to be processed into the first image encoder in the feature extraction module to obtain the global feature; and The image to be processed is input into the second image encoder of the feature extraction module to obtain the fine-grained features.

4. The method according to claim 2, wherein: The step of inputting the global features and the fine-grained features into a multimodal fusion module to obtain image features of the image to be processed includes: Inputting the global feature into the self-attention module of the multimodal fusion module to obtain a first feature; and, Inputting the fine-grained features into the convolution module of the multimodal fusion module to obtain a second feature; The first feature and the second feature are fused to obtain the image feature of the image to be processed.

5. The method according to claim 1, further comprising: Determine the model type corresponding to the desired image recognition task; When the model type is the large language model, it is determined to adopt the large language model to complete the expected image recognition task.

6. The method according to claim 5, further comprising: In a case where the model type is an image recognition model that matches the desired image recognition task, using the image recognition model to recognize the image to be processed; The scale of the graph recognition model is smaller than that of the large language model; In the case that the image recognition model fails to recognize an image, it is determined to adopt the large language model to complete the desired image recognition task.

7. The method according to claim 5, wherein: The determining the model type corresponding to the expected image recognition task includes: The mapping relationship table between the expected image recognition task and the adaptation model is searched to obtain the model type corresponding to the expected image recognition task.

8. The method according to claim 7, wherein: When the desired image recognition task is to recognize the image subject, the corresponding model type is a cognitive model; When the desired image recognition task is to search for images, the corresponding model type is an image search model; When the expected image recognition task is to recognize text in an image, the corresponding model type is a character recognition problem-solving model; When the expected image recognition task is for the user to describe the complex image content, the corresponding model type is the large language model.

9. A method for training a multimodal large model, the multimodal large model comprising a feature extraction model and a large language model, the method comprising: Inputting the first sample image into the feature extraction model to be optimized to obtain image features of the first sample image; Based on the image features of the first sample image and the target image recognition task, construct prompt information of the large language model; Inputting the prompt information into the large language model to obtain prediction information corresponding to the first sample image; Comparing the prediction information with the annotation information of the first sample image corresponding to the target image recognition task to determine a first loss value; The feature extraction model to be optimized is adjusted based on the first loss value, and the multimodal large model is obtained when the convergence condition is met.

10. The method according to claim 9, wherein: The feature extraction model to be optimized includes a feature extraction module to be optimized and a multimodal fusion module to be optimized. The step of inputting the first sample image into the feature extraction model to be optimized to obtain image features of the first sample image includes: Inputting the first sample image into the feature extraction module to be optimized to obtain global features and fine-grained features of the first sample image; The global features and the fine-grained features are input into the multimodal fusion module to be optimized to obtain image features of the first sample image.

11. The method according to claim 10, wherein: The step of inputting the first sample image into the feature extraction module to be optimized to obtain global features and fine-grained features of the first sample image includes: Inputting the first sample image into the first image encoder to be optimized in the feature extraction module to be optimized to obtain the global feature; and The first sample image is input into the second image encoder to be optimized of the feature extraction module to be optimized to obtain the fine-grained features.

12. The method according to claim 10, wherein: The step of inputting the global features and the fine-grained features into the multimodal fusion module to be optimized to obtain image features of the first sample image includes: Inputting the global feature into the self-attention module to be optimized of the multimodal fusion module to be optimized to obtain a third feature; and Inputting the fine-grained features into the convolution module to be optimized of the multimodal fusion module to be optimized to obtain a fourth feature; The third feature and the fourth feature are fused to obtain an image feature of the first sample image.

13. The method according to claim 11, further comprising obtaining the first image encoder to be optimized based on the following manner: Inputting the first sample pair into an initial image-text contrast model, obtaining global features of the second sample image in the first sample pair output by an initial first image encoder in the initial image-text contrast model, and text features of text information in the first sample pair output by an initial text encoder in the image-text contrast model; Determining a first contrastive learning loss based on the global features of the second sample image and the text features of the text information; The model parameters of the initial image-text contrast model are adjusted based on the first contrastive learning loss, and when a convergence condition is met, the initial first image encoder is determined as the first image encoder to be optimized.

14. The method according to claim 11, further comprising obtaining the second image encoder to be optimized based on the following manner: Inputting the third sample image in the second sample pair into an initial second image encoder of the initial image processing model, and inputting the fourth sample image in the second sample pair into the initial third image encoder of the initial image processing model, to obtain a fifth image feature output by the initial second image encoder, and a sixth image feature output by the initial third image encoder; determining a second contrastive learning loss based on the fifth image feature and the sixth image feature; adjusting the model parameters of the initial image processing model based on the second contrastive learning loss, and determining the initial second image encoder as the second image encoder to be optimized when a convergence condition is met; in, The second contrastive learning loss is used to reduce the gap between positive sample pairs and increase the gap between negative sample pairs.

15. An image processing device, comprising: A first prediction unit, used to predict the expected image recognition task of the target object for the image to be processed; A first extraction unit is used to extract image features of the image to be processed when a large language model is used to complete the desired image recognition task; A first construction unit, configured to construct prompt information of the large language model based on the image features of the image to be processed and the desired image recognition task; The processing unit is used to input the prompt information into the large language model to obtain the image recognition result of the image to be processed.

16. The device according to claim 15, wherein: The first extraction unit comprises: A first extraction subunit is used to input the image to be processed into a feature extraction module to obtain global features and fine-grained features of the image to be processed; The first fusion subunit is used to input the global features and the fine-grained features into a multimodal fusion module to obtain image features of the image to be processed.

17. The device according to claim 16, wherein: The first extraction subunit is used for: Inputting the image to be processed into the first image encoder in the feature extraction module to obtain the global feature; and The image to be processed is input into the second image encoder of the feature extraction module to obtain the fine-grained features.

18. The device according to claim 16, wherein: The first fusion subunit is used for: Inputting the global feature into the self-attention module of the multimodal fusion module to obtain a first feature; and, Inputting the fine-grained features into the convolution module of the multimodal fusion module to obtain a second feature; The first feature and the second feature are fused to obtain the image feature of the image to be processed.

19. The apparatus according to claim 15, further comprising a first determining unit, configured to: Determine the model type corresponding to the desired image recognition task; When the model type is the large language model, it is determined to adopt the large language model to complete the expected image recognition task.

20. The apparatus according to claim 19, further comprising a second determining unit, configured to: In the case where the model type is an image recognition model that matches the desired image recognition task, the image recognition model is used to recognize the image to be processed; the scale of the image recognition model is smaller than that of the large language model; In the case that the image recognition model fails to recognize an image, it is determined to adopt the large language model to complete the desired image recognition task.

21. The device according to claim 19, wherein The first determination unit is specifically used to search for a mapping relationship table between the expected image recognition task and the adaptation model to obtain the model type corresponding to the expected image recognition task.

22. The apparatus of claim 21, wherein: When the desired image recognition task is to recognize the image subject, the corresponding model type is a cognitive model; When the desired image recognition task is to search for images, the corresponding model type is an image search model; When the expected image recognition task is to recognize text in an image, the corresponding model type is a character recognition problem-solving model; When the expected image recognition task is for the user to describe the complex image content, the corresponding model type is the large language model.

23. A training device for a multimodal large model, the multimodal large model comprising a feature extraction model and a large language model, the device comprising: A second extraction unit, used for inputting the first sample image into the feature extraction model to be optimized to obtain image features of the first sample image; A second construction unit, configured to construct prompt information of the large language model based on image features of the first sample image and a target image recognition task; A second prediction unit, configured to input the prompt information into the large language model to obtain prediction information corresponding to the first sample image; a comparing unit, configured to compare the prediction information with the annotation information of the first sample image corresponding to the target image recognition task, and determine a first loss value; An optimization unit is used to adjust the feature extraction model to be optimized based on the first loss value, and obtain the multimodal large model when a convergence condition is met.

24. The device according to claim 23, wherein: The feature extraction model to be optimized includes a feature extraction module to be optimized and a multimodal fusion module to be optimized, and the second extraction unit includes: A second extraction subunit is used to input the first sample image into the feature extraction module to be optimized to obtain global features and fine-grained features of the first sample image; The second fusion subunit is used to input the global features and the fine-grained features into the multimodal fusion module to be optimized to obtain image features of the first sample image.

25. The device according to claim 24, wherein: The second extraction subunit is used for: Inputting the first sample image into the first image encoder to be optimized in the feature extraction module to be optimized to obtain the global feature; and The first sample image is input into the second image encoder to be optimized of the feature extraction module to be optimized to obtain the fine-grained features.

26. The device according to claim 24, wherein: The second fusion subunit is used for: Inputting the global feature into the self-attention module to be optimized of the multimodal fusion module to be optimized to obtain a third feature; and Inputting the fine-grained features into the convolution module to be optimized of the multimodal fusion module to be optimized to obtain a fourth feature; The third feature and the fourth feature are fused to obtain an image feature of the first sample image.

27. The apparatus according to claim 25, further comprising a first pre-training unit, configured to: Inputting the first sample pair into an initial image-text contrast model, obtaining global features of the second sample image in the first sample pair output by an initial first image encoder in the initial image-text contrast model, and text features of text information in the first sample pair output by an initial text encoder in the image-text contrast model; Determining a first contrastive learning loss based on the global features of the second sample image and the text features of the text information; The model parameters of the initial image-text contrast model are adjusted based on the first contrastive learning loss, and when a convergence condition is met, the initial first image encoder is determined as the first image encoder to be optimized.

28. The apparatus according to claim 25, further comprising a second pre-training unit, configured to: Inputting the third sample image in the second sample pair into an initial second image encoder of the initial image processing model, and inputting the fourth sample image in the second sample pair into the initial third image encoder of the initial image processing model, to obtain a fifth image feature output by the initial second image encoder, and a sixth image feature output by the initial third image encoder; determining a second contrastive learning loss based on the fifth image feature and the sixth image feature; adjusting the model parameters of the initial image processing model based on the second contrastive learning loss, and determining the initial second image encoder as the second image encoder to be optimized when a convergence condition is met; in, The second contrastive learning loss is used to reduce the gap between positive sample pairs and increase the gap between negative sample pairs.

29. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 14.

30. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-14.

31. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 14.

Citation Information

Patent Citations

  • Target object identification method, and training method and device of multi-modal identification model

    CN116226785A

  • Image processing method and device based on artificial intelligence, equipment and storage medium

    CN116975336A

  • Image processing method and device, equipment and medium

    CN117711001A

  • Multi-modal biological feature recognition method based on third-order knowledge distillation

    CN117831138A

  • Image processing method and device and character image processing model training method and device

    CN118038248A