Image restoration method, device and medium based on multimodal large language model
Through the image repair method based on the multi-modal large language model, combined with image features and text description, a targeted repair process is generated, which solves the problems of high computational complexity and poor deep learning effect in the existing technology, and achieves efficient, Accurate image restoration.
Patent Information
- Application Number
- CN202411170754.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-26
AI Technical Summary
Existing image restoration technology has high computational complexity when dealing with complex image degradation, and there are many model combinations and execution sequences, making it difficult to manually select the optimal solution. Deep learning technology is not effective when dealing with specific types of degradation, resulting in poor repair quality and efficiency. Difference.
Using an image repair method based on a multi-modal large language model, the model is trained through multi-modal data pairs, combined with image features and text descriptions, to identify the degradation type and location, generate a targeted repair process, and dynamically use the multi-modal decoder to Adjust and iteratively optimize until the best results.
It improves the efficiency and quality of image repair. By deeply understanding the intrinsic relationship between image content and language description, it generates a more comprehensive and accurate repair strategy, achieves continuous learning and optimization, and improves repair performance.
Smart Images

Figure CN118691511B_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the field of natural language processing technology, and in particular to an image restoration method, device and medium based on a multimodal large language model. Background Art
[0002] With the rapid advancement of information technology, images have become the core medium for information transmission, and their quality and integrity are directly related to the accuracy and effectiveness of information transmission. However, in practical applications, images are often damaged by various degradation factors such as poor shooting environment, transmission data loss, physical media aging, etc., resulting in blurring, breakage, staining, and even partial loss of text images, which not only damages the visual beauty of the image, but also seriously weakens the readability and utilization value of the information. Therefore, image restoration technology has become an important processing step in the process of image information acquisition.
[0003] The current image restoration process generally uses intelligent algorithms to identify the specific degradation type in the image; then, based on the recognition results, the corresponding restoration model is automatically selected and executed in order. The processing order in this process has a significant impact on the restoration quality, requiring accurate identification of degradation patterns and optimization of task execution order to ensure the best restoration effect. However, with the complexity of processing tasks, the number of potential model combinations and execution orders has increased dramatically, and the computational complexity has risen sharply, making it impractical to manually select the optimal solution. Although deep learning technology can handle a variety of degradation situations, when dealing with a specific type of degradation, its effect is often not as good as that of professional models designed specifically for that degradation, resulting in poor quality and efficiency of image restoration. Summary of the invention
[0004] In order to solve the above technical problems, one or more embodiments of this specification provide an image restoration method, device and medium based on a multimodal large language model.
[0005] One or more embodiments of this specification adopt the following technical solutions:
[0006] One or more embodiments of this specification provide an image restoration method based on a multimodal large language model, the method comprising:
[0007] The initial multimodal large language model is trained using a multimodal data pair as a training set to obtain a multimodal large language model that meets the requirements; wherein the multimodal data pair is a data pair obtained by associating a degraded image sample with a text description of the degraded image sample;
[0008] Extracting image features of the image to be restored based on a preset image encoder, identifying degradation types and degradation position information of the image to be restored according to the image features, and determining keywords corresponding to the image to be restored based on an association between the degradation types and preset keywords;
[0009] Inputting the degradation type, degradation location information and the keyword into a preset description template to obtain an initial image degradation description, and reconstructing the initial image degradation description based on the multimodal large language model to obtain a current image degradation description;
[0010] Based on the current image degradation description and the image semantic representation of the image to be repaired, determining fused degradation information of the image to be repaired, so as to input the fused degradation information into the multimodal large language model to obtain a repair process of the image to be repaired;
[0011] The repair process is fused with the image semantic representation as a multimodal input, and input into a preset multimodal decoder to dynamically adjust the repair process based on the preset multimodal decoder to obtain a preliminary repair result, and the repair process is adjusted based on the preliminary repair result to obtain an optimal repair process.
[0012] Optionally, in one or more embodiments of the present specification, the initial multimodal large language model is trained using the multimodal data pairs as a training set to obtain a multimodal large language model that meets the requirements, and the method further includes:
[0013] Acquire multiple types of degraded image samples based on public channels, and transmit the degraded image samples to multiple collaborative expert evaluation terminals based on a preset interface; wherein each collaborative expert evaluation terminal has a corresponding evaluation level;
[0014] Acquire the initial text description of each degraded image sample uploaded by each collaborative expert evaluation port, filter out words irrelevant to the degraded image in the initial text description based on the attributes corresponding to each word in the initial text description, and obtain a description word sequence related to the degraded image in the initial text description;
[0015] Based on the matching relationship between the preset first trigger word, the preset second trigger word and the description word, the description word sequence is divided into a position description word sequence and a type description word sequence; wherein the preset first trigger word corresponds to the position information, and the second trigger word corresponds to the degradation type;
[0016] Based on the position description word sequence and the type description word sequence, a text description of each degraded image sample is determined, so as to associate and connect the text description of each degraded image sample with each of the degraded image samples to obtain a multimodal data pair, so as to form a multimodal data pair training set based on the multimodal data pairs.
[0017] Optionally, in one or more embodiments of the present specification, determining a text description of each degraded image sample based on the position description word sequence and the type description word sequence specifically includes:
[0018] The position description word sequence and type description word sequence of the same degraded image sample are divided into a position set and a type set respectively;
[0019] Determining effective location description words of the degraded image sample based on the frequency of occurrence of the same location description words in the location set and the evaluation level of the collaborative expert evaluation terminal corresponding to each location description word;
[0020] Determining effective type description words of the degraded image sample based on the frequency of occurrence of the same type description words in the type set and the evaluation level of the collaborative expert evaluation terminal corresponding to each type description word;
[0021] The parts of speech corresponding to the effective position description words and the effective type description words are obtained, and the effective position description words and the effective type description words are connected based on preset grammar rules and the parts of speech to determine the text description of each of the degraded image samples.
[0022] Optionally, in one or more embodiments of this specification,
[0023] Extracting image features of the image to be restored based on a preset image encoder, identifying degradation types and degradation position information of the image to be restored according to the image features, and determining keywords corresponding to the image to be restored based on an association between the degradation types and preset keywords, specifically including:
[0024] Inputting the image to be repaired into a preset image encoder to obtain a multi-scale feature map corresponding to the image to be repaired;
[0025] Respectively obtaining the restoration requirements of the image to be restored for the degradation type and the degradation position information, so as to allocate the multi-scale feature map to one or more branch structures based on the restoration requirements; wherein each of the branch structures includes at least one main branch structure, and each of the branch structures performs information exchange based on a dependency relationship;
[0026] Based on the dependency relationship of each of the branch structures, determining a feature transfer path of the image to be restored;
[0027] Acquire a historical feature extraction record matching the image to be restored based on the feature transfer path, determine an enhancement process corresponding to each of the branch structures based on the historical feature extraction record, and enhance the output feature of each of the branch structures according to the enhancement process to obtain an enhanced feature;
[0028] Based on the feature transfer path, each of the enhanced features is merged to obtain a feature to be identified;
[0029] According to the preset target detection algorithm and the spatial information corresponding to the feature to be identified, the degradation position information of the image to be repaired is identified, and the degradation type of the feature to be identified is classified based on the built-in classifier to obtain the degradation type of the image to be repaired;
[0030] Based on a preset association relationship table, determining an association relationship between the degradation type and a preset keyword, so as to determine a keyword corresponding to the image to be restored based on the association relationship mapping. Optionally, in one or more embodiments of the present specification, before determining the keyword corresponding to the image to be restored based on the association relationship between the degradation type and the preset keyword, the method further includes:
[0031] Acquire text data containing degradation types based on multiple data sources, and pre-process the text data to extract keywords related to the degradation types in each of the text data;
[0032] Determine the number of cluster centers based on the number of degenerate types, evenly divide the keywords based on the number of cluster centers to obtain multiple initial keyword clusters, and randomly determine the initial cluster center of each initial keyword;
[0033] Traversing the keywords in each of the initial keyword clusters to determine the similarity between each of the keywords and the initial cluster center, and clustering and updating the keywords according to the similarity to obtain a current keyword cluster;
[0034] Reselecting the cluster center of the keyword based on the keywords in each of the current keyword clusters to iteratively obtain the clustering results of the keyword;
[0035] Based on the clustering result, the keyword corresponding to each degradation type is determined to construct an association relationship between the degradation type and the corresponding keyword, and the keyword is added to a preset association relationship table.
[0036] Optionally, in one or more embodiments of the present specification, the degradation type, the degradation location information and the keyword are input into a preset description template to obtain an initial image degradation description, and the initial image degradation description is reconstructed based on the multimodal large language model to obtain a current image degradation description, specifically including:
[0037] Acquire a preset description template and a placeholder of the preset description template, and acquire a corresponding relationship between a label corresponding to the placeholder and the degradation type, the degradation position information, and the keyword;
[0038] Filling the degradation type, the degradation position information and the keyword into the preset description template based on the corresponding relationship to obtain an initial image degradation description;
[0039] Extracting visual features of the image to be restored based on the multimodal large language model, so as to align and associate the initial image degradation description with the visual features to obtain a multimodal image degradation description;
[0040] The multimodal image degradation description is reconstructed based on the semantic planning strategy of the multimodal large language model to obtain a reconstructed current image degradation description.
[0041] Optionally, in one or more embodiments of the present specification, the repair process and the image semantic representation are fused into a multimodal input, and input into a preset multimodal decoder to dynamically adjust the repair process based on the preset multimodal decoder to obtain a preliminary repair result, specifically including:
[0042] Determine a plurality of repair tasks corresponding to the repair process, and determine corresponding model information corresponding to each repair task according to a key relationship between each repair task and the model;
[0043] Determine a processing mechanism of the corresponding model according to the model information, implicitly fuse the repair task with the image semantic representation based on the processing mechanism, and directly splice and fuse the repair task in the repair process, the model information corresponding to the repair task, and the image semantic representation;
[0044] According to the implicit fusion and the direct splicing fusion, the restoration process and the image semantic representation are fused into a multimodal input to input a preset multimodal decoder;
[0045] The image restoration effect corresponding to the multimodal input is obtained based on a preset multimodal decoder, so as to dynamically adjust the restoration process based on the image restoration effect to obtain a preliminary restoration result.
[0046] Optionally, in one or more embodiments of the present specification, the repair process is adjusted based on the preliminary repair result to obtain an optimal repair process, specifically including:
[0047] Based on the preliminary repair result and the preset quality parameters, determining whether the preliminary repair result meets the quality requirements;
[0048] If yes, the preliminary restoration result is used as the restoration result of the image to be restored;
[0049] If not, then determining the deviation parameter between the preliminary repair result and the preset quality parameter to determine the designated repair process corresponding to the deviation parameter;
[0050] The repair parameters of the specified repair process are obtained to iteratively adjust the repair parameters to obtain an optimal repair process.
[0051] One or more embodiments of this specification provide an image restoration device based on a multimodal large language model, the device comprising:
[0052] at least one processor; and,
[0053] a memory communicatively connected to the at least one processor; wherein,
[0054] 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 of the above-mentioned methods.
[0055] One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute any of the above-described methods.
[0056] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0057] The initial modal large language model is adjusted based on multimodal data pairs. By learning the data of both image and text modalities at the same time, the model can more deeply understand the intrinsic relationship between the image content and its language description. By determining the keywords corresponding to the image to be repaired according to the correlation between the degradation type and the preset keywords, it is helpful to analyze the degradation of the image to be repaired and provide a targeted repair strategy. By reconstructing the initial image degradation description based on the multimodal large language model to obtain the current image degradation description, the problem that the image degradation description generated by the prior art is often relatively simple and lacks depth, and cannot fully reflect the degradation condition of the image is solved, which helps to improve the effect of subsequent repair. The current image degradation description is deeply integrated with the image semantic representation of the image to be repaired, so that the model can more comprehensively understand the degradation condition and context information of the image. Then, based on the fused degradation information, the multimodal large language model can generate a targeted repair process to achieve a more efficient repair effect. The repair process is continuously iterated and improved until the best effect is achieved. This feedback mechanism ensures that the system can continue to learn and optimize, and continuously improve the repair performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:
[0059] Figure 1 A flowchart of an image restoration method based on a multimodal large language model provided in an embodiment of this specification;
[0060] Figure 2 A schematic diagram of the entire process of image restoration based on a multimodal large language model in an application scenario provided in an embodiment of this specification;
[0061] Figure 3 A schematic diagram of the structure of an image restoration device based on a multimodal large language model provided in an embodiment of this specification;
[0062] Figure 4 A schematic diagram of the structure of a non-volatile storage medium provided in an embodiment of this specification. DETAILED DESCRIPTION
[0063] The embodiments of this specification provide an image restoration method, device and medium based on a multimodal large language model.
[0064] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0065] like Figure 1 As shown, the embodiment of this specification provides a flowchart of an image restoration method based on a multimodal large language. Figure 1 It can be seen that in one or more embodiments of this specification, a method for image restoration based on a multimodal large language includes:
[0066] S101: training an initial multimodal large language model using a multimodal data pair as a training set to obtain a multimodal large language model that meets the requirements; wherein the multimodal data pair is a data pair obtained by associating a degraded image sample with a text description of the degraded image sample.
[0067] In order to obtain a multimodal large language model with enhanced image restoration capabilities, in the embodiment of this specification, the initial multimodal large language model is first trained and adjusted according to the multimodal data training set, so as to obtain a multimodal large language model that meets the requirements. It should be noted that the multimodal data pair is a data pair consisting of a degraded image sample and a text description of the degraded image sample. In this process, the initial modal large language model is adjusted based on the multimodal data pair. By simultaneously learning the data of the two modalities of image and text, the model can have a deeper understanding of the intrinsic connection between the image content and its language description. In addition, the use of a variety of degraded image samples and corresponding text descriptions for training can enable the model to learn different types and degrees of image damage, and learn how to adapt to different restoration needs. This extensive training helps to improve the generalization ability of the model, enabling it to handle a wider range of image restoration tasks.
[0068] For example, the implementation method of this process in a certain application scenario of this specification is as follows: first, collect large-scale text-image pair data, and the data set contains various types of degraded images and their corresponding high-quality images. Degradation types should cover but not be limited to blur, noise, color distortion, tearing, moiré, water mist, overbrightness and dimness. Then annotate each degraded image with its specific degradation type and degree, and generate a corresponding text description for each image, detailing the degradation. These text descriptions will constitute a multimodal data pair together with the image data. The Qwen-VL model is fine-tuned based on the constructed training data to obtain a new language model with enhanced image restoration capabilities. Specifically, Qwen-VL is developed based on the Tongyi Qianwen 7 billion parameter model Qwen-7B as the base language model, supports image and text input, and has multimodal information understanding capabilities.
[0069] Further, in one or more embodiments of the present specification, before the initial multimodal large language model is trained and adjusted based on the multimodal data training set to obtain a multimodal large language model that meets the requirements, the method further includes the following process:
[0070] First, multiple types of degraded image samples are obtained based on public channels, and the degraded image samples are transmitted to multiple collaborative expert evaluation terminals based on preset interfaces; it should be noted that different collaborative expert evaluation terminals have corresponding evaluation levels. Then, the initial text description of each degraded image sample uploaded by each collaborative expert evaluation port is obtained, and based on the attributes corresponding to each word in the initial text description, the words irrelevant to the degraded image in the initial text description are filtered out to obtain a description word sequence related to the degraded image in the initial text description. By using the preset interface and the automated processing flow, the irrelevant words in the initial text description are filtered out, and only the description word sequence related to the degraded image is retained. This process not only improves the purity and accuracy of the text description, but also reduces manual intervention and improves processing efficiency. Then, according to the matching relationship between the preset first trigger word and the preset second trigger word and the description word, the description word sequence is divided into a position description word sequence and a type description word sequence. Among them, the preset first trigger word corresponds to the position information, and the second trigger word corresponds to the degradation type. In this process, the description word sequence is divided by the preset trigger word, so that the process has a certain flexibility. The trigger words can be adjusted according to actual needs to adapt to different application scenarios and data characteristics. This flexibility helps to improve the versatility and practicality of the process. Then, based on the position description word sequence and the type description word sequence, the text description of each degraded image sample is determined to associate the text description of each degraded image sample with each degraded image sample, and obtain multimodal data pairs to form a multimodal data pair training set. By associating the text description of each degraded image sample with the image sample, a multimodal data pair training set is constructed. This multimodal data pair can make full use of information in both image and text modes, which helps to train the initial multimodal large language model based on the multimodal data pair training set, so as to adjust the parameters of the initial multimodal large language model based on the training results to obtain a multimodal large language model that meets the requirements.
[0071] Furthermore, in one or more embodiments of the present specification, based on the position description word sequence and the type description word sequence, determining the text description of each degraded image sample specifically includes the following process:
[0072] First, the position description word sequence and type description word sequence of the same degraded image sample are divided into a position set and a type set respectively. Then, according to the frequency of the same position description word in the position set and the evaluation level of the collaborative expert evaluation end corresponding to each position description word, the effective position description word of the degraded image sample is determined. Similarly, according to the frequency of the same type description word in the type set and the evaluation level of the collaborative expert evaluation end corresponding to each type description word, the effective type description word of the degraded image sample is determined. Then, the parts of speech corresponding to the effective position description words and the effective type description words are obtained, so that the effective position description words and the effective type description words are connected according to the preset grammatical rules and parts of speech to obtain the text description of each degraded image sample. By considering the frequency of the position description words and the type description words and the evaluation level of the collaborative expert evaluation end, the effective description words of the degraded image sample can be determined more accurately, thereby improving the accuracy of the text description. Combined with the evaluation level of the collaborative expert evaluation end, the influence of subjective factors on the selection of description words is reduced, making the text description more objective. By dividing the position description words and the type description words into the position set and the type set respectively, different aspects of the image can be comprehensively considered and a more comprehensive text description can be provided. By connecting valid description words according to preset grammar rules and parts of speech, it can be flexibly adjusted according to specific needs and language habits to generate a text description with clear structure and logical coherence, making the text description more in line with the actual situation.
[0073] S102: extracting image features of the image to be restored based on a preset image encoder, identifying degradation types and degradation position information of the image to be restored according to the image features, and determining keywords corresponding to the image to be restored based on an association between the degradation types and preset keywords.
[0074] In order to analyze the degradation of the image to be repaired and provide a targeted repair strategy. Figure 2 As shown, after the image is input, the image features are obtained. Therefore, in the embodiment of this specification, the image features of the image to be repaired are extracted according to the preset image encoder. Thus, the degradation type and degradation position information of the image to be repaired are identified according to the image features. At the same time, the keywords corresponding to the image to be repaired are determined according to the association between the degradation type and the preset keywords.
[0075] In a certain application scenario, the process may include the following processes: first, image feature extraction is performed, that is, the input image is extracted using a pre-trained image encoder to analyze the global and local features of the image. Then, based on the results of the image feature analysis, the main degradation types and degradation location information in the image are identified. Specifically, the degradation categories include blur, noise, color distortion, tearing, ripples, water mist, overbrightness, dimness, etc.; blur refers to the lack of clarity of the contours and edges in the image, and the details are blurred. Noise refers to visible noise points, spots, etc. in the image. Color distortion refers to the difference between the color of the image and the actual color, and there may be hue deviation or saturation problems; fracture refers to cracks or missing parts in the image. Ripple refers to striped interference or moiré in the image. Water mist refers to the influence of water droplets or water stains on the surface of the image. Overbrightness refers to the excessive brightness of some parts of the image, resulting in loss of details. Dimness refers to the lack of overall brightness of the image and insufficient details. In addition, in order to clarify the specific characteristics of degradation, corresponding keywords will be generated according to the identified degradation types. For example, if the image is noticeably blurry, include keywords such as "blurry" or "missing detail" in the text description.
[0076] Specifically, in one or more embodiments of the present specification, image features of the image to be restored are extracted based on a preset image encoder, so as to identify the degradation type and degradation position information of the image to be restored according to the image features, and keywords corresponding to the image to be restored are determined based on the association between the degradation type and the preset keywords, which specifically includes the following processes:
[0077] First, the image to be repaired is input into a preset image encoder to obtain a multi-scale feature map corresponding to the image to be repaired. The multi-scale feature map of the image to be repaired obtained by the preset image encoder can capture information of different levels and scales of the image, which is conducive to a more comprehensive understanding of the image content, especially for the details and complex structures in the image, which is conducive to more accurate subsequent repair and recognition. Then, the repair requirements of the image to be repaired for the degradation type and the degradation position information are obtained respectively, so as to assign the multi-scale feature map to one or more branch structures based on the repair requirements; wherein each branch structure includes at least one main branch structure, and each branch structure interacts with information based on the dependency relationship. This process assigns the multi-scale feature map to different branch structures according to the repair requirements, and each branch structure can focus on a specific task or feature extraction, thereby improving the flexibility and pertinence of the processing. In addition, the dependency relationship and information interaction between the branch structures enhance the ability of feature representation, so that the network can learn more complex patterns. Based on the dependency relationship of each branch structure, the feature transfer path of the image to be repaired is determined. Then, the historical feature extraction records matching the repaired image are obtained according to the feature transfer path, so as to determine the enhancement processing corresponding to each branch structure based on the historical feature extraction records, and then the output features of each branch structure are enhanced according to the enhancement processing to obtain the enhanced features. Then, the enhanced features are fused based on the feature transfer path to obtain the features to be identified; this step effectively uses previous knowledge to guide the current feature processing, further improving the quality and recognizability of the features. Feature fusion can integrate the information of different branch structures to obtain a more comprehensive and representative feature representation.
[0078] Then, according to the preset target detection algorithm and the spatial information corresponding to the feature to be identified, the degradation position information of the image to be repaired is identified, and the degradation type of the feature to be identified is classified based on the built-in classifier to obtain the degradation type of the image to be repaired. This method uses the preset target detection algorithm and the spatial information of the feature to be identified to accurately identify the degradation position of the image to be repaired. At the same time, the built-in classifier can classify the degradation type and provide accurate degradation type information. This precise recognition and classification capability provides an important basis for subsequent image repair and provides key guidance for subsequent repair. Then, based on the preset association relationship table, the association relationship between the degradation type and the preset keyword is determined to determine the keyword corresponding to the image to be repaired based on the association relationship mapping. Through the preset association relationship table, the degradation type is associated with the preset keyword to map, so as to determine the keyword corresponding to the image to be repaired. This automated mapping method not only improves efficiency, but also avoids subjectivity and errors that may be caused by human intervention. The determination of keywords is helpful for subsequent image management, retrieval and recommendation applications. The entire process from image input to keyword output forms an end-to-end processing flow, reducing interference and error accumulation in the intermediate links and improving overall processing efficiency and accuracy.
[0079] Furthermore, in one or more embodiments of the present specification, before determining the keyword corresponding to the image to be restored based on the association relationship between the degradation type and the preset keyword, the method further includes:
[0080] First, in order to improve the diversity and comprehensiveness of data sources, in the embodiment of this specification, text data containing degradation types is obtained based on multiple data sources, and the text data is preprocessed to extract keywords related to the degradation type in each text data, and the text data is preprocessed and keyword extraction is performed, which effectively removes noise and irrelevant information, while retaining keywords closely related to the degradation type. Then, the number of cluster centers is determined based on the number of degradation types, and the keywords are evenly divided based on the number of cluster centers to obtain multiple initial keyword clusters, and the initial cluster centers of each initial keyword are randomly determined. In this process, the number of cluster centers is determined based on the number of degradation types, and the method of even division and random determination of the initial cluster centers is adopted to realize an adaptive clustering process. This method can flexibly cope with different numbers of degradation types and avoid the subjectivity and uncertainty caused by artificially setting the number of cluster centers. After obtaining the initial keyword cluster clusters, the keywords in each initial keyword cluster cluster are traversed to determine the similarity between each keyword and the initial cluster center, so as to cluster and update the keywords according to the similarity to obtain the current keyword cluster cluster. Then, based on the keywords in each current keyword cluster, the cluster center of the keyword is reselected to iteratively obtain the clustering result of the keyword, and the clustering result of the keyword is continuously optimized through iterative steps such as traversing keywords, calculating similarity, clustering update and reselecting cluster centers. This iterative optimization method can gradually approach the real clustering structure and improve the accuracy and stability of clustering. Based on the clustering results, the keywords corresponding to each degradation type are determined, so as to construct the association relationship between the degradation type and the corresponding keyword, and add it to the preset association relationship table.
[0081] S103: Inputting the degradation type, degradation location information and the keyword into a preset description template to obtain an initial image degradation description, and reconstructing the initial image degradation description based on the multimodal large language model to obtain a current image degradation description.
[0082] The image degradation descriptions generated by the prior art are often relatively simple and lack depth, and cannot fully reflect the degradation condition of the image. A large amount of manual intervention is often required to generate the image degradation description, which is not only inefficient but also prone to human errors. Therefore, in an embodiment of the present specification, the degradation type, degradation location information and keywords are input into a preset description template to obtain an initial image degradation description, and the initial image degradation description is reconstructed based on a multimodal large language model to obtain the current image degradation description. This process generates an initial image degradation description containing rich information by integrating the degradation type, degradation location information and keywords. This helps to more comprehensively reflect the degradation condition of the image. The application of a multimodal large language model further enhances the accuracy and richness of the description.
[0083] In a certain application scenario, the keywords that can be obtained can generate a general descriptive sentence based on the pre-set description template, such as: "There is {keyword} in the upper left corner of the image." Then generate a detailed text description based on the template and keywords. For example, if the image is blurred, the description is: "The details of the image are blurred, especially the edges of the subject." The generated text description is sent to the language model for reconstruction to form a more natural, smooth and accurate description.
[0084] Specifically, in one or more embodiments of the present specification, the degradation type, the degradation location information and the keywords are input into a preset description template to obtain an initial image degradation description, and the initial image degradation description is reconstructed based on a multimodal large language model to obtain a current image degradation description, which specifically includes the following process:
[0085] In order to improve the organization and readability of the degradation description, the embodiments of this specification obtain a preset description template and a placeholder of the preset description template, so as to determine the correspondence between the label corresponding to the placeholder and the degradation type, degradation location information and keywords, and then fill the degradation type, degradation location information and keywords into the preset description template according to the correspondence to obtain the initial image degradation description. Based on the multimodal large language model, the visual features of the image to be repaired are extracted, so as to align and associate the initial image degradation description with the visual features to obtain a multimodal image degradation description. The multimodal image degradation description is reconstructed according to the semantic planning strategy of the multimodal large language model to obtain the reconstructed current image degradation description. Based on the correspondence between the placeholder and the degradation type, degradation location information and keywords, this process can ensure that this information is accurately filled into the template, avoiding omission or misplacement of information. The visual features of the image to be repaired are extracted through a multimodal large language model, and these visual features are aligned and associated with the initial image degradation description. The introduction of visual features provides additional contextual information for the description, which helps to better understand the degradation of the image. This process realizes the fusion of multimodal information, which not only enhances the accuracy of the description, but also makes the description more vivid and intuitive. The semantic planning strategy of the multimodal large language model can reconstruct the multimodal image degradation description and generate a current image degradation description that is more in line with human language habits and cognitive laws.
[0086] S104: Based on the current image degradation description and the image semantic representation of the image to be repaired, determine fused degradation information of the image to be repaired, and input the fused degradation information into the multimodal large language model to obtain a repair process of the image to be repaired.
[0087] In order to solve the problem of general restoration methods for dealing with the degradation of different images, the lack of targeted personalized restoration strategies, and the fact that the existing technology often requires a lot of manual intervention to formulate restoration strategies and perform restoration operations, which is not only inefficient but also prone to human error, the embodiment of this specification will determine the fused degradation information of the image to be restored based on the current image degradation description and the image semantic representation of the image to be restored, so as to input the fused degradation information into the multimodal large language model to obtain the restoration process of the image to be restored. The current image degradation description is deeply fused with the image semantic representation of the image to be restored, so that the model can more comprehensively understand the degradation status and contextual information of the image. Then, based on the fused degradation information, the multimodal large language model can generate a targeted restoration process. This personalized restoration strategy can fully consider the specific degradation conditions and restoration requirements of different images, thereby achieving a more efficient restoration effect.
[0088] In a certain application scenario, based on the current image degradation description and the image semantic representation of the image to be repaired, the fused degradation information of the image to be repaired is determined, so as to input the fused degradation information into the multimodal large language model to obtain the repair process of the image to be repaired, which can be performed based on the following process:
[0089] Step 1 Input fusion: Combine the image semantic representation of the image to be parsed with the previous image degradation description.
[0090] Step 2: Analysis and decision making: The fused information is input into the pre-trained language model, which will analyze the type and degree of image degradation based on its trained knowledge base and determine which restoration techniques are most suitable for the current situation.
[0091] Step: Restoration process generation: Based on the output of the language model, a specific restoration process is generated. This process guides the subsequent image restoration steps based on the available model pool, and the models in the available model pool will be selected according to the degradation type. For example, if the image is blurred, the deblurring model may be selected; if the image is noisy, the denoising model will be selected; if the image has color distortion, the color correction model will be selected, and so on. For complex degradation situations, multiple models are combined to solve different degradation problems layer by layer. For example, the denoising model is first used to reduce the impact of noise, the super-resolution model is then used to increase the clarity of the image, and finally the color correction model is used to optimize the image color. Specifically, assume a comprehensive set of degradation types, represented as , where each Indicates a specific type of image degradation. For each degradation type , customized an optional model library , including models Each model They are specially trained to reduce Impact of degradation types. Input: Degraded images affected by various degradation types D, model library Tailored to handle D. Objective: Determine the optimal model execution sequence σ = S (D, M) represents the set of all possible degradation sequences and model pairs.
[0092] S105: The repair process is integrated with the image semantic representation into a multimodal input, and input into a preset multimodal decoder to dynamically adjust the repair process based on the preset multimodal decoder to obtain a preliminary repair result, and the repair process is adjusted based on the preliminary repair result to obtain an optimal repair process.
[0093] The repair process generated according to the input image to be repaired and the prompt in the above step S104 includes the repair tasks to be performed, the execution order and the model most suitable for each task. In order to obtain the best repair process, the repair process and the image semantic representation are fused into a multimodal input in the embodiment of this specification, so as to be input into the preset multimodal decoder to dynamically correct the repair process and obtain a preliminary repair result. Then, the repair process is adjusted according to the preliminary repair result to obtain the best repair process, so as to further repair the image to be repaired according to the best repair process. By merging the repair process and the image semantic representation into a multimodal input, the system can dynamically adjust the repair process according to the real-time semantic information and degradation of the image. This dynamic adaptability enables the system to more flexibly cope with image repair tasks of different complexities and improve the accuracy and effect of the repair. The multimodal decoder can accurately optimize the repair process based on rich multimodal information, and the mechanism of feedback adjusting the repair process according to the preliminary repair result is a closed-loop control strategy. It allows the system to continuously iterate and improve the repair process according to the actual repair effect until the best effect is achieved. This feedback mechanism ensures that the system can continue to learn and optimize and continuously improve the repair performance.
[0094] Specifically, in one or more embodiments of the present specification, the restoration process and the image semantic representation are integrated into a multimodal input, and the restoration process is dynamically adjusted by inputting a preset multimodal decoder to obtain a preliminary restoration result, which specifically includes the following process:
[0095] Determine multiple repair tasks corresponding to the repair process, and determine the corresponding model information corresponding to each repair task according to the key relationship between each repair task and the model. Then determine the processing mechanism of the corresponding model according to the model information, so as to implicitly fuse the repair task with the image semantic representation according to the processing mechanism, and directly splice and fuse the repair task in the repair process and the model information corresponding to the repair task with the image semantic representation. At the same time, according to implicit fusion and direct splicing fusion, the repair process and the image semantic representation are fused into a multimodal input, which is input into a preset multimodal decoder, and the image repair effect corresponding to the multimodal input is obtained through the preset multimodal decoder, so as to dynamically adjust the repair process based on the image repair effect and obtain a preliminary repair result. In this process, the repair process is combined with the image semantic representation through implicit fusion and direct splicing fusion, and the system can more comprehensively understand the image degradation and repair requirements. This helps to reduce erroneous repairs caused by inaccurate or missing single information sources. At the same time, multimodal input and multi-step feedback adjustment also improve the robustness of the system to complex situations such as noise and blur. The preset multimodal decoder can intelligently adjust the restoration process based on the input multimodal information to ensure that each task can be optimally processed. And: Based on the real-time feedback of the image restoration effect, the system can dynamically adjust the restoration process to ensure that the restoration process is always in the best state. The restoration process after multimodal fusion and dynamic adjustment can generate high-quality preliminary restoration results to meet the user's restoration needs. The preliminary restoration results can serve as the basis for subsequent iterations, and through further optimization and adjustment, a more perfect restoration effect can be finally obtained.
[0096] In a certain application scenario, the restoration process is integrated with the image semantic representation as a multimodal input, and the restoration process is dynamically adjusted by inputting a preset multimodal decoder. The preliminary restoration result can also be achieved through the following process:
[0097] Step 1 Input integration: The best restoration process generated in step S4 and the image semantic representation obtained in step S2 are integrated into a multimodal input.
[0098] Step 2: Strategy execution and dynamic adjustment: The multimodal decoder starts the restoration process based on the input optimal restoration process. It will perform the corresponding image restoration tasks according to the instructions in the strategy, and can make dynamic adjustments during the process. For example, if it is found that the effect of a task is not as expected, the decoder can re-evaluate the optimal process through an iterative decision-making process and make real-time adjustments.
[0099] Step 3 Iterative decision-making process: Real-time feedback: The decoder evaluates the effect of image restoration after each step and adjusts subsequent processing steps based on feedback. Historical context utilization: Use historical data from previous processing to guide future decisions. For example, if a certain type of degradation has achieved good results using a certain technique in the past, the decoder will tend to use the same technique when encountering similar degradation in the future.
[0100] Step 4 Rollback function: When undesirable results (such as image quality degradation) are detected during the repair process, the decoder can automatically roll back to a previous good state and try other repair strategies.
[0101] Step 5 Multi-stage restoration: The entire restoration process may involve multiple stages, each focusing on solving different types of degradation problems. For example, the first stage focuses on noise removal, the second stage focuses on detail enhancement, the third stage targets color correction, etc.
[0102] For example: A user asks “How to improve the quality of this image? [Execution history:…]”.
[0103] An output sequence representing the optimal repair is generated, which includes a series of tasks, each of which is associated with a specific model that is best suited to handle a specific degradation mode. The output template is defined as: "<task name><model name>. 2. <task name><model name>. 3. ...".
[0104] Further, in one or more embodiments of the present specification, adjusting the repair process based on the feedback of the preliminary repair result to obtain the best repair process specifically includes:
[0105] In the prior art, many image restoration systems lack an effective quality control mechanism, resulting in uneven quality of restoration results. Therefore, when obtaining a preliminary restoration result, it is determined whether the preliminary restoration result meets the quality based on the preliminary restoration result and the preset quality parameters. If it meets the quality, the preliminary restoration result will be used as the restoration result of the image to be restored. On the contrary, if it does not meet the quality, the deviation parameter between the preliminary restoration result and the preset quality parameter will be determined to obtain the specified restoration process corresponding to the deviation parameter. By obtaining the restoration parameters of the specified restoration process and iteratively adjusting the restoration parameters, the best restoration process can be obtained. After determining the specified restoration process, the system will iteratively adjust the restoration parameters to obtain the best restoration process. This iterative optimization process can continuously approach the optimal solution to ensure that the final restoration process can generate high-quality restoration results. The process can flexibly select and adjust the restoration process according to different preliminary restoration results and deviation parameters. This flexibility enables the system to adapt to a variety of different image restoration scenarios and requirements.
[0106] In a certain application scenario, the repair process is adjusted based on the feedback of the preliminary repair results to obtain the best repair process, which can be specifically implemented based on the following steps:
[0107] Step 1: Initial attempt: The model first generates a preliminary repair plan based on the input prompt. If this preliminary plan cannot meet the repair requirements or the effect is not good, it enters the iterative fine-tuning stage.
[0108] Step 2: Evaluation and feedback: Evaluate the initial repair results of the model to determine whether they meet the expected quality standards. If not, collect specific feedback on the reasons for failure.
[0109] Step 3: Iterative correction: Based on the feedback information, the model adjusts its processing logic and parameter configuration to improve the results. During this process, the model will be optimized specifically for specific image features or damage types.
[0110] Step 4: Recursive detection and correction: After each attempt, the model checks whether the result meets the requirements. If not, it continues to make corrections until a satisfactory repair effect is achieved. In order to improve efficiency, a single round of prompting is used for fine-tuning. The model can update its response multiple times in one iteration cycle without waiting for the entire cycle to end. This allows the model to continuously improve its solution within a limited time until the best repair solution is found.
[0111] like Figure 3 As shown, the embodiment of this specification provides a schematic diagram of the structure of an image restoration device based on a multimodal large language model. Figure 3 It can be seen that in one or more embodiments of this specification, an image restoration device based on a multimodal large language model includes:
[0112] at least one processor; and,
[0113] a memory communicatively connected to the at least one processor; wherein,
[0114] 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 of the above-mentioned methods.
[0115] like Figure 4 As shown, the present specification provides a schematic diagram of the structure of a non-volatile storage medium. Figure 4 It can be seen that in one or more embodiments of the present specification, a non-volatile storage medium stores computer executable instructions 401, and the computer executable instructions 401 can execute any of the above-mentioned methods.
[0116] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0117] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0118] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.
Claims
1. An image restoration method based on a multimodal large language model, characterized in that: The method comprises: The initial multimodal large language model is trained using a multimodal data pair as a training set to obtain a multimodal large language model that meets the requirements; wherein the multimodal data pair is a data pair obtained by associating a degraded image sample with a text description of the degraded image sample; Extracting image features of the image to be restored based on a preset image encoder, identifying degradation types and degradation position information of the image to be restored according to the image features, and determining keywords corresponding to the image to be restored based on an association between the degradation types and preset keywords; Inputting the degradation type, degradation location information and the keyword into a preset description template to obtain an initial image degradation description, and reconstructing the initial image degradation description based on the multimodal large language model to obtain a current image degradation description; Based on the current image degradation description and the image semantic representation of the image to be repaired, determining fused degradation information of the image to be repaired, so as to input the fused degradation information into the multimodal large language model to obtain a repair process of the image to be repaired; The repair process is fused with the image semantic representation as a multimodal input, and input into a preset multimodal decoder to dynamically adjust the repair process based on the preset multimodal decoder to obtain a preliminary repair result, and the repair process is adjusted based on the preliminary repair result to obtain an optimal repair process.
2. The image restoration method based on a multimodal large language model according to claim 1, characterized in that: The initial multimodal large language model is trained using the multimodal data pairs as a training set to obtain a multimodal large language model that meets the requirements. The method further includes: Acquire multiple types of degraded image samples based on public channels, and transmit the degraded image samples to multiple collaborative expert evaluation terminals based on a preset interface; wherein each collaborative expert evaluation terminal has a corresponding evaluation level; Acquire the initial text description of each degraded image sample uploaded by each collaborative expert evaluation port, filter out words irrelevant to the degraded image in the initial text description based on the attributes corresponding to each word in the initial text description, and obtain a description word sequence related to the degraded image in the initial text description; Based on the matching relationship between the preset first trigger word, the preset second trigger word and the description word, the description word sequence is divided into a position description word sequence and a type description word sequence; wherein the preset first trigger word corresponds to the position information, and the second trigger word corresponds to the degradation type; Based on the position description word sequence and the type description word sequence, a text description of each degraded image sample is determined, so as to associate and connect the text description of each degraded image sample with each of the degraded image samples to obtain a multimodal data pair, so as to form a multimodal data pair training set based on the multimodal data pairs.
3. The image restoration method based on a multimodal large language model according to claim 2, characterized in that: Based on the position description word sequence and the type description word sequence, determining a text description of each degraded image sample specifically includes: The position description word sequence and type description word sequence of the same degraded image sample are divided into a position set and a type set respectively; Determining effective location description words of the degraded image sample based on the frequency of occurrence of the same location description words in the location set and the evaluation level of the collaborative expert evaluation terminal corresponding to each location description word; Determining effective type description words of the degraded image sample based on the frequency of occurrence of the same type description words in the type set and the evaluation level of the collaborative expert evaluation terminal corresponding to each type description word; The parts of speech corresponding to the effective position description words and the effective type description words are obtained, and the effective position description words and the effective type description words are connected based on preset grammar rules and the parts of speech to determine the text description of each of the degraded image samples.
4. The image restoration method based on a multimodal large language model according to claim 1, characterized in that: Extracting image features of the image to be restored based on a preset image encoder, identifying degradation types and degradation position information of the image to be restored according to the image features, and determining keywords corresponding to the image to be restored based on an association between the degradation types and preset keywords, specifically including: Inputting the image to be repaired into a preset image encoder to obtain a multi-scale feature map corresponding to the image to be repaired; Respectively obtaining the restoration requirements of the image to be restored for the degradation type and the degradation position information, so as to allocate the multi-scale feature map to one or more branch structures based on the restoration requirements; wherein each of the branch structures includes at least one main branch structure, and each of the branch structures performs information exchange based on a dependency relationship; Based on the dependency relationship of each of the branch structures, determining a feature transfer path of the image to be restored; Acquire a historical feature extraction record matching the image to be restored based on the feature transfer path, determine an enhancement process corresponding to each of the branch structures based on the historical feature extraction record, and enhance the output feature of each of the branch structures according to the enhancement process to obtain an enhanced feature; Based on the feature transfer path, each of the enhanced features is merged to obtain a feature to be identified; According to the preset target detection algorithm and the spatial information corresponding to the feature to be identified, the degradation position information of the image to be repaired is identified, and the degradation type of the feature to be identified is classified based on the built-in classifier to obtain the degradation type of the image to be repaired; Based on a preset association relationship table, an association relationship between the degradation type and a preset keyword is determined, so as to determine a keyword corresponding to the image to be repaired based on the association relationship mapping.
5. The image restoration method based on a multimodal large language model according to claim 1, characterized in that: Before determining the keyword corresponding to the image to be restored based on the association relationship between the degradation type and the preset keyword, the method further includes: Acquire text data containing degradation types based on multiple data sources, and pre-process the text data to extract keywords related to the degradation types in each of the text data; Determine the number of cluster centers based on the number of degenerate types, evenly divide the keywords based on the number of cluster centers to obtain multiple initial keyword clusters, and randomly determine the initial cluster center of each initial keyword; Traversing the keywords in each of the initial keyword clusters to determine the similarity between each of the keywords and the initial cluster center, and clustering and updating the keywords according to the similarity to obtain a current keyword cluster; Reselecting the cluster center of the keyword based on the keywords in each of the current keyword clusters to iteratively obtain the clustering results of the keyword; Based on the clustering result, the keyword corresponding to each degradation type is determined to construct an association relationship between the degradation type and the corresponding keyword, and the keyword is added to a preset association relationship table.
6. The image restoration method based on a multimodal large language model according to claim 1, characterized in that: Inputting the degradation type, degradation location information and the keyword into a preset description template to obtain an initial image degradation description, and reconstructing the initial image degradation description based on the multimodal large language model to obtain a current image degradation description, specifically including: Acquire a preset description template and a placeholder of the preset description template, and acquire a corresponding relationship between a label corresponding to the placeholder and the degradation type, the degradation position information, and the keyword; Filling the degradation type, degradation location information and the keyword into the preset description template based on the corresponding relationship to obtain an initial image degradation description; Extracting visual features of the image to be restored based on the multimodal large language model, so as to align and associate the initial image degradation description with the visual features to obtain a multimodal image degradation description; The multimodal image degradation description is reconstructed based on the semantic planning strategy of the multimodal large language model to obtain a reconstructed current image degradation description.
7. The image restoration method based on a multimodal large language model according to claim 1, characterized in that: The repair process and the image semantic representation are integrated into a multimodal input, and input into a preset multimodal decoder to dynamically adjust the repair process based on the preset multimodal decoder to obtain a preliminary repair result, specifically including: Determine a plurality of repair tasks corresponding to the repair process, and determine corresponding model information corresponding to each repair task according to a key relationship between each repair task and the model; Determine a processing mechanism of the corresponding model according to the model information, implicitly fuse the repair task with the image semantic representation based on the processing mechanism, and directly splice and fuse the repair task in the repair process, the model information corresponding to the repair task, and the image semantic representation; According to the implicit fusion and the direct splicing fusion, the restoration process and the image semantic representation are fused into a multimodal input to input a preset multimodal decoder; The image restoration effect corresponding to the multimodal input is obtained based on a preset multimodal decoder, so as to dynamically adjust the restoration process based on the image restoration effect to obtain a preliminary restoration result.
8. The image restoration method based on a multimodal large language model according to claim 1, characterized in that: Adjusting the repair process based on the preliminary repair result to obtain the best repair process specifically includes: Based on the preliminary repair result and the preset quality parameters, determining whether the preliminary repair result meets the quality requirements; If yes, the preliminary restoration result is used as the restoration result of the image to be restored; If not, then determining the deviation parameter between the preliminary repair result and the preset quality parameter to determine the designated repair process corresponding to the deviation parameter; The repair parameters of the specified repair process are obtained to iteratively adjust the repair parameters to obtain an optimal repair process.
9. An image restoration device based on a multimodal large language model, characterized in that: The device comprises: at least one processor; and, 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 so that the at least one processor can: execute any of the methods described in claims 1-8.
10. A non-volatile storage medium storing computer executable instructions characterized in that: The computer executable instructions can: execute the method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Multi-modal feature fusion text-guided image restoration method
CN111340122A
Image recovery method and device based on pre-training auto-encoder
CN111462000A
