Image description generation method and device, electronic equipment and storage medium

By adding a preset adjustment module and a sliding window module to the large multi-modal model, and combining historical image collections to train the generated model, the problem of low accuracy in high-resolution image description is solved, and more accurate image description and higher-level models are achieved. performance.

CN118736243APending Publication Date: 2024-10-01INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Application Number
CN202410902059.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing multi-modal large models cannot obtain more detailed information when processing high-resolution images, resulting in low accuracy of image description and the inability to accurately generate image text descriptions of images, which is especially difficult when understanding and narrating complex scenes.

Method used

By adding a preset adjustment module and a sliding window module to the preset language model, the local features of the image are identified, and the generation model is trained based on historical image collections. A multi-level feature fusion method is used to generate detailed image descriptions.

Benefits of technology

It improves the accuracy of image description and the input image resolution of the model, enhances the ability to understand image details, and improves the performance of multi-modal large models in tasks such as image description generation and scene question and answer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736243A_ABST
    Figure CN118736243A_ABST
Patent Text Reader

Abstract

The invention discloses an image description generation method and device, electronic equipment and a storage medium, and relates to the field of artificial intelligence, financial science and technology or other related fields, and the generation method comprises the steps: inputting a target image into a preset language model, outputting a plurality of local features and global features of the target image, and outputting a plurality of local features and global features of the target image; and inputting the plurality of local features and the global feature into a preset generation model, and outputting a target image description of the target image. The technical problem that accurate image description cannot be generated for the image in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a method for generating an image description, a device thereof, an electronic device and a storage medium. Background Art

[0002] At present, multimodal big models can be applied in multiple scenarios. For example, in customer service scenarios, the use of multimodal big models based on deep learning technology, combined with natural language processing and computer vision technology, can provide intelligent customer service; in financial research scenarios, multimodal big models can integrate multi-source data for financial forecasting and analysis, thereby providing more accurate and in-depth financial research; in intelligent dialogue assistant scenarios, multimodal big models can generate manuscripts based on the provided content, summarize the content based on the article, polish the text based on the content, etc., and can also achieve image content generation and other functions through the visual question-answering capabilities of multimodal big models.

[0003] However, in the related art, the resolution of the input image of most multimodal large models needs to be consistent with the input size of the visual encoder used in its architecture. Therefore, it is impossible to process high-resolution input images, resulting in the model being unable to obtain more detailed information from the image. At the same time, since the image text description used in training the model is relatively simple, the model's accuracy is low and it is unable to accurately generate image text descriptions of the image, making it difficult to handle complex scene understanding and narration.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide a method for generating an image description and a device thereof, an electronic device and a storage medium, so as to at least solve the technical problem in the related art that an accurate image description cannot be generated for an image.

[0006] According to one aspect of an embodiment of the present invention, a method for generating an image description is provided, comprising: inputting a target image into a preset language model, and outputting a plurality of local features and a global feature of the target image, wherein the preset language model comprises: a preset adjustment module, and the preset adjustment module is used to identify the features of the target image; inputting the plurality of local features and the global features into a preset generation model, and outputting a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and the image description corresponding to each historical image in the historical image set.

[0007] Furthermore, the generation method also includes: constructing a sliding window module and the preset adjustment module, and adding the preset adjustment module to the visual encoder, wherein the sliding window module is used to use a preset step size to slide the input image to obtain multiple local images; the visual encoder is used to extract features of the input image and the local images; based on the sliding window module, the visual encoder and the resampler, an initial language model is constructed, wherein the resampler is used to resample the features extracted by the visual encoder.

[0008] Furthermore, after constructing the initial language model, it also includes: collecting the historical image set and annotating each of the historical image in the historical image set to obtain a labeled image set; using the annotated image set to train the preset adjustment module to obtain target adjustment parameters of the preset adjustment module; using the target adjustment parameters to update the parameters in the preset adjustment module to obtain the preset language model.

[0009] Furthermore, the generation method also includes: collecting the historical image set, and performing sliding processing on each of the historical images in the historical image set to obtain a local image set; using an image description model to process the historical image and the local image set corresponding to the historical image to obtain an initial description of each preset image, and supplementing the annotation information of the preset image to the initial description to obtain a global description of the preset image, wherein the preset image is the historical image or the local image, and the annotation information is information obtained by annotating the preset image in advance; using an area box generation model to annotate the area box on the preset image and generate object information for each area box, and using an image recognition model to extract the area box position and text information of the area box on the preset image, and adding the text information to the object information; using a segmentation model to segment the preset image to obtain multiple segmentation maps, and using the image description model to process the segmentation map to obtain description information of the segmentation map, wherein each segmentation map corresponds to a segmentation position.

[0010] Furthermore, the generation method also includes: evaluating each of the area boxes and the object information corresponding to the area boxes to obtain a first evaluation score for each of the area boxes, and deleting the target area boxes indicated by the first evaluation score that is less than a first preset evaluation threshold and the object information corresponding to the target area boxes; evaluating each of the segmentation maps and the description information corresponding to the segmentation maps to obtain a second evaluation score for each of the segmentation maps, and deleting the target segmentation maps indicated by the second evaluation score that is less than a second preset evaluation threshold and the description information corresponding to the target segmentation maps; generating the image description of the historical image based on the global description, the remaining area boxes and the object information corresponding to the area boxes, the remaining segmentation maps and the description information corresponding to the segmentation maps, the area box positions of the remaining area boxes, and the segmentation positions of the remaining segmentation maps.

[0011] Furthermore, after generating the image description of the historical image, it also includes: constructing an initial generation model; using the historical image set and the image description corresponding to each of the historical images in the historical image set to train the initial generation model to obtain the preset generation model.

[0012] Furthermore, the step of inputting the target image into a preset language model and outputting multiple local features and global features of the target image includes: using the sliding window module to slide the target image to obtain multiple local images; using the visual encoder to extract features of the target image and each of the local images; using the resampler to resample the extracted features of the target image to obtain the global features, and using the resampler to resample the extracted features of the local images to obtain the local features.

[0013] According to another aspect of an embodiment of the present invention, there is also provided a device for generating image description, comprising: a first input unit, used to input a target image into a preset language model, and output a plurality of local features and a global feature of the target image, wherein the preset language model comprises: a preset adjustment module, and the preset adjustment module is used to identify the features of the target image; a second input unit, used to input a plurality of the local features and the global features into a preset generation model, and output a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and the image description corresponding to each historical image in the historical image set.

[0014] Furthermore, the generating device also includes: a first construction module, used to construct a sliding window module and the preset adjustment module, and add the preset adjustment module to the visual encoder, wherein the sliding window module is used to slide the input image with a preset step size to obtain multiple local images; the visual encoder is used to extract features of the input image and the local image; a second construction module, used to construct an initial language model based on the sliding window module, the visual encoder and the resampler, wherein the resampler is used to resample the features extracted by the visual encoder.

[0015] Furthermore, the generating device also includes: a first acquisition module, which is used to acquire the historical image set after constructing the initial language model, and annotate each of the historical image in the historical image set to obtain an annotated image set; a first training module, which is used to train the preset adjustment module using the annotated image set to obtain target adjustment parameters of the preset adjustment module; and a first updating module, which is used to update the parameters in the preset adjustment module using the target adjustment parameters to obtain the preset language model.

[0016] Furthermore, the generating device further comprises: a first processing module, which is used to collect the historical image set, and perform sliding processing on each of the historical images in the historical image set to obtain a local image set; a second processing module, which is used to process the historical image and the local image set corresponding to the historical image using an image description model to obtain an initial description of each preset image, and supplement the annotation information of the preset image to the initial description to obtain a global description of the preset image, wherein the preset image is the historical image or the local image, and the annotation information is information obtained by annotating the preset image in advance; a first annotation module, which is used to annotate the preset image with a region frame generation model and generate object information for each region frame, and extract the region frame position and text information of the region frame on the preset image using an image recognition model, and add the text information to the object information; a first segmentation module, which is used to segment the preset image using a segmentation model to obtain multiple segmentation maps, and process the segmentation map using the image description model to obtain description information of the segmentation map, wherein each segmentation map corresponds to a segmentation position.

[0017] Furthermore, the generating device also includes: a first evaluation module, used to evaluate each of the area boxes and the object information corresponding to the area boxes, obtain a first evaluation score for each of the area boxes, and delete the target area boxes indicated by the first evaluation score that is less than a first preset evaluation threshold and the object information corresponding to the target area boxes; a second evaluation module, used to evaluate each of the segmentation maps and the description information corresponding to the segmentation maps, obtain a second evaluation score for each of the segmentation maps, and delete the target segmentation maps indicated by the second evaluation score that is less than a second preset evaluation threshold and the description information corresponding to the target segmentation maps; a first generating module, used to generate the image description of the historical image based on the global description, the remaining area boxes and the object information corresponding to the area boxes, the remaining segmentation maps and the description information corresponding to the segmentation maps, the area box positions of the remaining area boxes, and the segmentation positions of the remaining segmentation maps.

[0018] Furthermore, the generating device also includes: a third constructing module, used to construct an initial generating model after generating the image description of the historical image; and a second training module, used to train the initial generating model using the historical image set and the image description corresponding to each of the historical images in the historical image set to obtain the preset generating model.

[0019] Furthermore, the first input unit includes: a third processing module, used to use the sliding window module to perform sliding processing on the target image to obtain multiple local images; a first extraction module, used to use the visual encoder to extract features of the target image and each of the local images; a first sampling module, used to use the resampler to resample the extracted features of the target image to obtain the global features, and use the resampler to resample the extracted features of the local images to obtain the local features.

[0020] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for generating image descriptions.

[0021] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-mentioned methods for generating image descriptions.

[0022] In the present invention, a target image is input into a preset language model, a plurality of local features and a global feature of the target image are output, and the plurality of local features and the global feature are input into a preset generation model, and a target image description of the target image is output.

[0023] In the present invention, a preset adjustment model can be first added to the preset language model to identify the detailed features of the input image, and a historical image set and an image description pre-generated for each historical image can be used to train the preset generation model to improve the accuracy of the model. The target image can then be input into the preset language model for processing to obtain multiple local features and global features of the target image, and then the multiple local features and global features are input into the preset generation model for processing to obtain an accurate description of the target image, thereby solving the technical problem in the related art that an accurate image description cannot be generated for an image, and achieving the technical effect of generating a more accurate image description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0025] Figure 1 is a flowchart of an optional method for generating image description according to an embodiment of the present invention;

[0026] Figure 2 is a schematic diagram of a large language model architecture in an optional question-answering scenario according to an embodiment of the present invention;

[0027] Figure 3 is a schematic diagram of an optional device for generating image description according to an embodiment of the present invention;

[0028] Figure 4 It is a hardware structure block diagram of an electronic device (or mobile device) for a method for generating image description according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] It should be noted that the method for generating image description and the device thereof in the present invention can be used in the field of artificial intelligence when generating image descriptions, and can also be used in any field other than the field of artificial intelligence when generating image descriptions. The present invention does not limit the application field of the method for generating image description and the device thereof.

[0032] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set between the system and the relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0033] The present invention provides a method that supports inputting high-resolution images and generating detailed descriptions, which can expand the resolution of the input images to help the model complete the training of recognizing more image details. It can not only improve the resolution of the input images, but also reduce the cost, so that the multimodal large model can obtain better output results and show better performance in tasks such as image description generation, scene question answering, scene text-centric visual question answering, and document-oriented visual question answering.

[0034] In the present invention, the resolution of the input image of the model can be effectively improved without pre-training, which can not only reduce the training cost of the large model, but also improve the resolution of the input image after the model training. At the same time, a detailed description generation method based on multi-level feature fusion is also proposed to provide richer image description information, which helps to improve the performance of large models in multi-scenario applications, improve the degree of automation of financial institutions' business, and reduce workload and costs.

[0035] The multimodal big model trained by the present invention is suitable for scenarios such as detailed description generation, scenario question and answer, scene text-centric visual question and answer, and document-oriented visual question and answer. The use of the multimodal big model can solve intensive text question and answer tasks that most models in related technologies cannot complete, which helps to improve the big model's ability to understand and narrate complex scenarios, and thus provides convenience for financial institutions in financial analysis, lending risk prevention and control, and the construction of intelligent dialogue assistants.

[0036] The present invention is described in detail below in conjunction with various embodiments.

[0037] Embodiment 1

[0038] According to an embodiment of the present invention, an embodiment of a method for generating an image description 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.

[0039] Figure 1 is a flowchart of an optional method for generating image description according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0040] Step S101, inputting a target image into a preset language model, and outputting a plurality of local features and a global feature of the target image, wherein the preset language model comprises: a preset adjustment module, and the preset adjustment module is used to identify the features of the target image.

[0041] Step S102, inputting multiple local features and global features into a preset generation model, and outputting a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and an image description corresponding to each historical image in the historical image set.

[0042] Through the above steps, the target image can be input into the preset language model, multiple local features and global features of the target image can be output, the multiple local features and global features can be input into the preset generation model, and the target image description of the target image can be output. In an embodiment of the present invention, a preset adjustment model can be first added to the preset language model to identify the detailed features of the input image, and the preset generation model can be trained using a historical image set and an image description pre-generated for each historical image to improve the accuracy of the model, and then the target image can be input into the preset language model for processing to obtain multiple local features and global features of the target image, and then the multiple local features and global features can be input into the preset generation model for processing to obtain an accurate target image description, thereby solving the technical problem in the related art that an accurate image description cannot be generated for an image, and achieving the technical effect of generating a more accurate image description.

[0043] The embodiment of the present invention is described in detail below in combination with the above steps.

[0044] In the embodiment of the present invention, the resolution of the input image of the LMM (Language-Model-based Models, i.e., large language model) model is usually 224×224, which is consistent with the conventional input size of the CLIP model (Contrast iveLanguage-Image Pre-training, i.e., a multimodal learning model) used in its architecture. However, the resolution of the input image is crucial for interpreting text and complex image details. Using a CLIP model with a larger resolution, or directly expanding the input resolution of the CLIP model and then fine-tuning it, will result in huge training consumption.

[0045] Based on this, the embodiment of the present invention improves the large language model to increase the resolution of the input image.

[0046] Optionally, the generation method also includes: constructing a sliding window module and a preset adjustment module, and adding the preset adjustment module to the visual encoder, wherein the sliding window module is used to slide the input image with a preset step size to obtain multiple local images; the visual encoder is used to extract features of the input image and the local image; based on the sliding window module, the visual encoder and the resampler, an initial language model is constructed, wherein the resampler is used to resample the features extracted by the visual encoder.

[0047] In an embodiment of the present invention, a sliding window module may be added to the large language model to enable the large language model to receive high-resolution images, and a preset adjustment module may be added to the visual encoder in the large language model to identify detail-sensitive features of each image area.

[0048] In an embodiment of the present invention, a sliding window module and a preset adjustment module (for example, a LoRA (Low-Rank Adaptation, a model fine-tuning technology) module) can be constructed first, and the preset adjustment module can be added to the visual encoder, and then an initial language model can be constructed based on the sliding window module, the visual encoder and the resampler.

[0049] In an embodiment of the present invention, the sliding window module can use a preset step size to slide the input image to obtain multiple local images. In this embodiment, the size of the sliding window used by the sliding window module is consistent with the image resolution supported by the large language model, and then the sliding window is used to slide on the image, moving step by step according to a predetermined step size (such as a step size of M / 2, where M is the window size), ensuring that each movement covers different areas of the image. For example, assuming that the size of the input image is H×W, H υ ×W υ (H υ ×W υ The image is divided into smaller local regions using a sliding window of a size that is consistent with the image resolution supported by the large language model.

[0050] In an embodiment of the present invention, by adding a preset adjustment module to the visual encoder, detail-sensitive features of each image region can be effectively identified and extracted, thereby enhancing the understanding of spatial and contextual relationships.

[0051] In an embodiment of the present invention, the resampler may resample the features extracted by the visual encoder to facilitate the subsequent fusion of local features and global features.

[0052] Optionally, after constructing the initial language model, it also includes: collecting a historical image set and annotating each historical image in the historical image set to obtain an annotated image set; using the annotated image set to train a preset adjustment module to obtain target adjustment parameters of the preset adjustment module; using the target adjustment parameters to update the parameters in the preset adjustment module to obtain a preset language model.

[0053] In an embodiment of the present invention, when training a preset language model, only the preset adjustment module can be trained, which can reduce the number of parameters and computing requirements, and enable the model to enhance the understanding of the details of the local image area and the contextual relationship while maintaining high efficiency. Specifically, a historical image set can be collected first, and each historical image in the historical image set is annotated (for example, the object attribute information of the historical image is annotated, including: object category, object quantity, etc.) to obtain an annotated image set. Then, the preset adjustment module is trained using the annotated image set to obtain the target adjustment parameters of the preset adjustment module, and then the target adjustment parameters are used to update the parameters in the preset adjustment module, thereby obtaining a preset language model.

[0054] In the embodiment of the present invention, the preset language model may be any large language model.

[0055] Optionally, the generation method also includes: collecting a set of historical images, and performing sliding processing on each historical image in the set of historical images to obtain a set of local images; using an image description model to process the historical images and the set of local images corresponding to the historical images to obtain an initial description of each preset image, and supplementing the annotation information of the preset image to the initial description to obtain a global description of the preset image, wherein the preset image is a historical image or a local image, and the annotation information is information obtained by annotating the preset image in advance; using an area box generation model to annotate the area box on the preset image and generate object information for each area box, and using an image recognition model to extract the area box position and text information of the area box on the preset image, and adding the text information to the object information; using a segmentation model to segment the preset image to obtain multiple segmentation maps, and using an image description model to process the segmentation map to obtain description information of the segmentation map, wherein each segmentation map corresponds to a segmentation position.

[0056] Currently, models are generally pre-trained using large-scale image and text data collected from the Internet. However, the annotations of such image and text data are relatively simple and lack richer image details. Even if high-resolution images are used for training, large multimodal models cannot establish accurate associations between image visual features and the objects therein, which may damage the synergy between visual processing and language understanding.

[0057] In an embodiment of the present invention, a detailed description generation method of multi-level feature fusion is proposed, which can use a multimodal pre-trained model (i.e., an image description model, for example, the BLIP-2 model (Bootstrapped Language Image Pretraining 2)), an image classification pre-trained model (i.e., a region box generation model, for example, the GRIT model (Guided Regularization Image Transformer)), an optical character recognition model based on deep learning (i.e., an image recognition model, for example, the PP-OCR model (PP-Optical Character Recognit ion)), a segmentation model (e.g., the SAM model (Spatial Attention Module)), etc. to provide a more detailed description for the image, so as to better align the high-resolution visual model and the language model.

[0058] In an embodiment of the present invention, a historical image set may be collected first, and each historical image in the historical image set may be subjected to sliding processing to obtain a plurality of partial images. Then, an image description model may be used to process the historical images and the partial image set corresponding to the historical images to obtain an initial description of each preset image (historical image or partial image), and the annotation information of the preset image may be supplemented to the initial description to obtain a global description of the preset image (for example, a BLIP-2 model may be used to generate a global description of the image, and the annotation information of the image may be used as a supplement to the global description). Then, a region frame generation model may be used to annotate the region frame on the preset image and generate object information for each region frame, and an image recognition model may be used to extract the region frame position and text information of the region frame on the preset image, and the text information may be added to the object information (for example, a GRIT model may be used to generate a region frame of the image, and the name and detailed description of the object in each region frame may be provided, including information such as attributes, actions and quantity, and in order to extract text information in the image, a PP-OCR model may also be used to extract the text frame coordinates and text content in the image). The segmentation model can be used to segment the preset image to obtain multiple segmentation maps (each segmentation map corresponds to a segmentation position), and then the segmentation map is processed by the image description model to obtain the description information of the segmentation map (for example, the SAM model is used to extract the segmentation map of each object and its components in the image, and then the segmentation map is used to cut out the object and sent to the BLIP-2 model to generate a detailed description of each object and its components). In this way, the global description of the image, the region box and the corresponding description, the segmentation map and the corresponding description can be obtained, so as to facilitate the subsequent generation of the image description of the image.

[0059] Optionally, the generation method also includes: evaluating each area box and the object information corresponding to the area box to obtain a first evaluation score for each area box, and deleting the target area box indicated by the first evaluation score less than a first preset evaluation threshold and the object information corresponding to the target area box; evaluating each segmentation map and the description information corresponding to the segmentation map to obtain a second evaluation score for each segmentation map, and deleting the target segmentation map indicated by the second evaluation score less than a second preset evaluation threshold and the description information corresponding to the target segmentation map; based on the global description, the remaining area boxes and the object information corresponding to the area boxes, the remaining segmentation maps and the description information corresponding to the segmentation maps, the area box positions of the remaining area boxes, and the segmentation positions of the remaining segmentation maps, an image description of the historical image is generated.

[0060] In an embodiment of the present invention, in order to ensure the accuracy of the generated image description, low-quality local descriptions can be filtered, and an image description model (e.g., BLIP-2 model) can be used to evaluate the consistency between image regions, objects and their descriptive texts, and filter out low-scoring local descriptions, specifically: the image description model can be used to evaluate each region box and the object information corresponding to the region box to obtain a first evaluation score for each region box, and the target region box indicated by the first evaluation score less than a first preset evaluation threshold (which can be set according to actual conditions) and the object information corresponding to the target region box are deleted, and each segmentation map and the description information corresponding to the segmentation map can be evaluated to obtain a second evaluation score for each segmentation map, and the target segmentation map indicated by the second evaluation score less than a second preset evaluation threshold (which can be set according to actual conditions) and the description information corresponding to the target segmentation map are deleted (i.e., the region box and the corresponding description, the segmentation map and the corresponding description with a lower evaluation score are deleted). Then, based on the global description, the remaining region boxes and the object information corresponding to the region boxes, the remaining segmentation maps and the description information corresponding to the segmentation maps, the region box positions of the remaining region boxes, and the segmentation positions of the remaining segmentation maps, the image description of the historical image is generated. For example, the global description, filtered region boxes and corresponding descriptions, filtered segmentation maps and corresponding descriptions, region box coordinates, and segmentation map coordinates are input into the large model for processing, and the large model is made to consider the positional relationship between each object and their mutual relationship, so as to generate an accurate image description.

[0061] Optionally, after generating the image description of the historical image, it also includes: constructing an initial generation model; using the historical image set and the image description corresponding to each historical image in the historical image set to train the initial generation model to obtain a preset generation model.

[0062] In an embodiment of the present invention, an initial generation model (i.e., a certain multimodal large model) can be constructed, and then the initial generation model can be trained using a historical image set and an image description corresponding to each historical image in the historical image set until the model converges, thereby obtaining a trained preset generation model.

[0063] Step S101, inputting a target image into a preset language model, and outputting a plurality of local features and a global feature of the target image, wherein the preset language model comprises: a preset adjustment module, and the preset adjustment module is used to identify the features of the target image.

[0064] In step S101, the preset language model is a pre-improved and trained large language model, including: a preset adjustment module, which is used to identify the features of the target image. In this embodiment, the target image can be input into the preset language model for processing to obtain multiple local features and global features of the target image.

[0065] In this embodiment, there is no need to limit the image resolution of the target image, and the target image can be a high-resolution image.

[0066] Optionally, the step of inputting the target image into a preset language model and outputting multiple local features and global features of the target image includes: using a sliding window module to slide the target image to obtain multiple local images; using a visual encoder to extract features of the target image and each local image; using a resampler to resample the extracted features of the target image to obtain global features, and using a resampler to resample the extracted features of the local image to obtain local features.

[0067] In an embodiment of the present invention, after the target image is input into the preset language model, the sliding window module in the preset language model can first slide the target image to obtain multiple local images (the image resolution of the local image is consistent with the resolution supported by the preset language model), and then use the visual encoder in the preset language model to extract features of the target image and each local image to identify and extract detailed features of each image, and then use the resampler in the preset language model to resample the extracted features of the target image and the features of the local image to obtain global features and local features.

[0068] Step S102, inputting multiple local features and global features into a preset generation model, and outputting a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and an image description corresponding to each historical image in the historical image set.

[0069] In step S102, the preset generation model is a multimodal large model trained using a historical image set and an image description corresponding to each historical image in the historical image set, wherein the image description of each historical image is obtained by a detailed description generation method of multi-level feature fusion. In this embodiment, multiple local features and global features output by the preset language model can be input into the preset generation model to obtain a target image description of the target image.

[0070] Figure 2 is a schematic diagram of a large language model architecture in an optional question-answering scenario according to an embodiment of the present invention, such as Figure 2As shown, questions and high-resolution images can be input into the Large Language Model (LLM). The large language model can first perform sliding window processing on the high-resolution image so that the high-resolution image is divided into multiple low-resolution images (the size of the low-resolution image is consistent with the resolution supported by the large language model). For each low-resolution image, the corresponding visual encoder (including the LoRA module and the ViT module, ViT is the original encoder) can be used for feature recognition. The high-resolution image can use the encoder ViT for feature recognition, and then the integration module is used to extract the recognized features to obtain multiple local features (Local Features) and global features (Global Features). After that, the multiple local features (Local Features) and global features (Global Features) are input into the multimodal large model to answer the question and output the answer.

[0071] In an embodiment of the present invention, a method for supporting input of high-resolution images and generating detailed descriptions is proposed, which can expand the resolution of the input image to help the model complete the training of identifying more image details, which can not only improve the resolution of the input image, but also reduce the cost, so that the multimodal large model can obtain better output results and show better performance in tasks such as image description generation, scene question answering, scene text-centered visual question answering, and document-oriented visual question answering. In addition, a detailed description generation method based on multi-level feature fusion is also proposed to provide richer image description information, which helps the large model to improve its performance in multi-scenario applications, improve the degree of automation of financial institutions' business, and reduce workload and cost.

[0072] The following is a detailed description in conjunction with another embodiment.

[0073] Embodiment 2

[0074] The image description generation device provided in this embodiment includes multiple implementation units, each of which corresponds to each implementation step in the above-mentioned embodiment 1.

[0075] Figure 3 is a schematic diagram of an optional image description generating device according to an embodiment of the present invention. Figure 3 As shown, the generating device may include: a first input unit 30 and a second input unit 31.

[0076] The first input unit 30 is used to input the target image into the preset language model, and output a plurality of local features and global features of the target image, wherein the preset language model includes: a preset adjustment module, and the preset adjustment module is used to identify the features of the target image;

[0077] The second input unit 31 is used to input multiple local features and global features into a preset generation model, and output a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and an image description corresponding to each historical image in the historical image set.

[0078] The above-mentioned generating device can input the target image into the preset language model through the first input unit 30, output multiple local features and global features of the target image, input multiple local features and global features into the preset generating model through the second input unit 31, and output the target image description of the target image. In the embodiment of the present invention, a preset adjustment model can be first added to the preset language model to identify the detailed features of the input image, and the preset generating model can be trained with a historical image set and an image description pre-generated for each historical image to improve the accuracy of the model, and then the target image can be input into the preset language model for processing to obtain multiple local features and global features of the target image, and then the multiple local features and global features are input into the preset generating model for processing to obtain an accurate target image description, thereby solving the technical problem in the related art that an accurate image description cannot be generated for an image, and achieving the technical effect of generating a more accurate image description.

[0079] Optionally, the generating device further includes: a first building module, used to construct a sliding window module and a preset adjustment module, and add the preset adjustment module to the visual encoder, wherein the sliding window module is used to slide the input image with a preset step size to obtain multiple local images; the visual encoder is used to extract features of the input image and the local image; and a second building module, used to construct an initial language model based on the sliding window module, the visual encoder and the resampler, wherein the resampler is used to resample the features extracted by the visual encoder.

[0080] Optionally, the generating device further includes: a first acquisition module, which is used to acquire a historical image set after constructing the initial language model, and to annotate each historical image in the historical image set to obtain an annotated image set; a first training module, which is used to train a preset adjustment module using the annotated image set to obtain target adjustment parameters of the preset adjustment module; and a first updating module, which is used to update parameters in the preset adjustment module using the target adjustment parameters to obtain a preset language model.

[0081] Optionally, the generating device further includes: a first processing module, which is used to collect a set of historical images, and perform sliding processing on each historical image in the set of historical images to obtain a set of local images; a second processing module, which is used to use an image description model to process the historical images and the set of local images corresponding to the historical images to obtain an initial description of each preset image, and supplement the annotation information of the preset image to the initial description to obtain a global description of the preset image, wherein the preset image is a historical image or a local image, and the annotation information is information obtained by annotating the preset image in advance; a first annotation module, which is used to use an area box generation model to annotate the area box on the preset image and generate object information for each area box, and use an image recognition model to extract the area box position and text information of the area box on the preset image, and add the text information to the object information; a first segmentation module, which is used to use a segmentation model to segment the preset image to obtain multiple segmentation maps, and use an image description model to process the segmentation map to obtain description information of the segmentation map, wherein each segmentation map corresponds to a segmentation position.

[0082] Optionally, the generating device further includes: a first evaluation module, used to evaluate each area box and the object information corresponding to the area box, obtain a first evaluation score for each area box, and delete the target area box and the object information corresponding to the target area box indicated by the first evaluation score less than a first preset evaluation threshold; a second evaluation module, used to evaluate each segmentation map and the description information corresponding to the segmentation map, obtain a second evaluation score for each segmentation map, and delete the target segmentation map and the description information corresponding to the target segmentation map indicated by the second evaluation score less than a second preset evaluation threshold; a first generating module, used to generate an image description of the historical image based on the global description, the remaining area boxes and the object information corresponding to the area boxes, the remaining segmentation maps and the description information corresponding to the segmentation maps, the area box positions of the remaining area boxes, and the segmentation positions of the remaining segmentation maps.

[0083] Optionally, the generating device also includes: a third building module, used to construct an initial generating model after generating an image description of the historical image; and a second training module, used to train the initial generating model using the historical image set and the image description corresponding to each historical image in the historical image set to obtain a preset generating model.

[0084] Optionally, the first input unit includes: a third processing module, used to use a sliding window module to perform sliding processing on the target image to obtain multiple local images; a first extraction module, used to use a visual encoder to extract features of the target image and each local image; a first sampling module, used to use a resampler to resample the features of the extracted target image to obtain global features, and use a resampler to resample the features of the extracted local images to obtain local features.

[0085] The above-mentioned generating device may also include a processor and a memory. The above-mentioned first input unit 30, the second input unit 31, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.

[0086] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and multiple local features and global features are input into a preset generation model by adjusting kernel parameters to output a target image description of the target image.

[0087] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.

[0088] The present invention also provides a computer program product which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: inputting a target image into a preset language model, outputting multiple local features and global features of the target image, inputting multiple local features and global features into a preset generation model, and outputting a target image description of the target image.

[0089] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium includes a stored computer program. When the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned method for generating image description.

[0090] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned method for generating image description.

[0091] Figure 4 is a hardware structure block diagram of an electronic device (or mobile device) for a method for generating image description according to an embodiment of the present invention. Figure 4 As shown, the electronic device may include one or more processors (e.g., Figure 4The processor 402a, processor 402b, ..., processor 402n, etc., which may include but are not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 404 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown.

[0092] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0093] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.

[0094] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0095] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0097] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0099] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for generating an image description, characterized in that: include: Inputting a target image into a preset language model, and outputting a plurality of local features and a global feature of the target image, wherein the preset language model comprises: a preset adjustment module, the preset adjustment module being used to identify the features of the target image; Input the plurality of local features and the global features into a preset generation model, and output a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and an image description corresponding to each historical image in the historical image set.

2. The generation method according to claim 1, characterized in that: The generating method further comprises: Constructing a sliding window module and the preset adjustment module, and adding the preset adjustment module to a visual encoder, wherein the sliding window module is used to slide the input image with a preset step length to obtain multiple local images; and the visual encoder is used to extract features of the input image and the local images; An initial language model is constructed based on the sliding window module, the visual encoder and the resampler, wherein the resampler is used to resample the features extracted by the visual encoder.

3. The generation method according to claim 2, characterized in that: After building the initial language model, it also includes: Collecting the historical image set, and annotating each of the historical images in the historical image set to obtain an annotated image set; Using the annotated image set to train the preset adjustment module to obtain target adjustment parameters of the preset adjustment module; The target adjustment parameters are used to update the parameters in the preset adjustment module to obtain the preset language model.

4. The generation method according to claim 1, characterized in that: The generating method further comprises: Collecting the historical image set, and performing sliding processing on each of the historical images in the historical image set to obtain a local image set; The historical image and the set of local images corresponding to the historical image are processed by an image description model to obtain an initial description of each preset image, and the annotation information of the preset image is added to the initial description to obtain a global description of the preset image, wherein the preset image is the historical image or the local image, and the annotation information is information obtained by annotating the preset image in advance; Using a region frame generation model to mark region frames on the preset image and generate object information for each region frame, and using an image recognition model to extract region frame positions and text information of the region frames on the preset image, and adding the text information to the object information; The preset image is segmented by using a segmentation model to obtain a plurality of segmentation maps, and the segmentation maps are processed by using the image description model to obtain description information of the segmentation maps, wherein each of the segmentation maps corresponds to a segmentation position.

5. The generation method according to claim 4, characterized in that: The generating method further comprises: Evaluate each of the area boxes and the object information corresponding to the area boxes to obtain a first evaluation score for each of the area boxes, and delete the target area boxes indicated by the first evaluation score that is less than a first preset evaluation threshold and the object information corresponding to the target area boxes; Evaluate each of the segmentation images and the description information corresponding to the segmentation images to obtain a second evaluation score for each of the segmentation images, and delete the target segmentation images indicated by the second evaluation score that is less than a second preset evaluation threshold and the description information corresponding to the target segmentation images; The image description of the historical image is generated based on the global description, the remaining area boxes and the object information corresponding to the area boxes, the remaining segmentation maps and the description information corresponding to the segmentation maps, the area box positions of the remaining area boxes, and the segmentation positions of the remaining segmentation maps.

6. The generation method according to claim 5, characterized in that: After generating the image description of the historical image, the method further includes: Build an initial generative model; The initial generation model is trained using the historical image set and the image description corresponding to each of the historical images in the historical image set to obtain the preset generation model.

7. The generation method according to claim 2, characterized in that: The step of inputting a target image into a preset language model and outputting a plurality of local features and a global feature of the target image comprises: Using the sliding window module to slide the target image to obtain a plurality of the local images; Using the visual encoder to extract features from the target image and each of the local images; The resampler is used to resample the extracted features of the target image to obtain the global features, and the resampler is used to resample the extracted features of the local image to obtain the local features.

8. A device for generating an image description, characterized in that: include: A first input unit is used to input a target image into a preset language model, and output a plurality of local features and a global feature of the target image, wherein the preset language model includes: a preset adjustment module, and the preset adjustment module is used to identify the features of the target image; A second input unit is used to input the multiple local features and the global features into a preset generation model, and output a target image description of the target image, wherein the preset generation model is a model trained based on a historical image set and an image description corresponding to each historical image in the historical image set.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for generating an image description according to any one of claims 1 to 7.

10. An electronic device, characterized in that: The invention comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating an image description as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image description generation method and device of specific area, equipment and storage medium

    CN114972774A

  • Image processing method and terminal device

    WO2023246822A1

Cited By

  • Remote sensing image semantic segmentation data enhancement method and system based on controllable diffusion model

    CN120997839A