Image enhancement model training method and device, electronic equipment and storage medium

By using the image enhancement model trained by multi-cue network in e-commerce image processing, the problem of detail retention and attention enhancement in image processing is solved, and the image quality and advertising effect are improved.

CN118608404AActive Publication Date: 2024-09-06BEIHANG UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410665004.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-09-06
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

Existing image processing algorithms cannot effectively retain product details and clarity in e-commerce image processing, and cannot focus attention on specific areas, resulting in reduced image quality and weakened advertising value.

Method used

By obtaining the training data set, extracting text masks and product object masks, training the multi-cue network in the initial convolutional neural network for image quality enhancement and attention redirection, combined with the multi-cue network to focus on attention areas and task details and image content to optimize the transfer learning efficiency and generalization ability of the model.

Benefits of technology

It achieves image quality improvement and attention redirection, significantly improves the transfer learning efficiency and generalization ability of the model, can more effectively retain the readability of product details and text information, and enhance the salience of products in images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608404A
    Figure CN118608404A
Patent Text Reader

Abstract

The embodiment of the invention discloses an image enhancement model training method and device, electronic equipment and a storage medium, which are applied to the technical field of image enhancement, and can solve the problems that a current image processing algorithm cannot effectively retain commodity details and definition and cannot perform attention enhancement on a certain area at the same time. The method comprises the steps of obtaining a training data set; performing feature extraction on each to-be-trained image sample to obtain a text mask and a commodity object mask; training a first multi-prompt network in the initial convolutional neural network through the text mask and the training data set, and training a second multi-prompt network in the initial convolutional neural network through the commodity object mask and the training data set to obtain a target image enhancement model; wherein the first multi-prompt network is used for carrying out quality enhancement on the image, and the second multi-prompt network is used for carrying out attention redirection on the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image enhancement technology, and in particular to an image enhancement model training method, device, electronic device and storage medium. Background Art

[0002] With the popularity of online shopping, e-commerce images play an important role in product display and attracting consumers. However, due to the limitations of online storage and bandwidth, e-commerce images usually need to be compressed, resulting in reduced image quality, unclear product details and advertising text, etc. In addition, the key products in some images are not prominent enough to effectively attract consumers' attention. These problems limit the practicality and advertising value of e-commerce images.

[0003] Although some existing algorithms for improving image quality and redirecting attention have achieved certain results in processing natural images, these technologies have limitations in the application of e-commerce image processing. The particularity of e-commerce images is that they usually contain product-oriented layouts and product-related text, which are essential for conveying product information. However, existing image processing technologies are not optimized for these specific elements, resulting in the inability to effectively retain product details and clarity when processing e-commerce images while ensuring the readability of text information. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present application provide an image enhancement model training method, device, electronic device and storage medium to solve the problem that the current image processing algorithm cannot effectively retain the details and clarity of the product and cannot enhance attention on a certain area.

[0005] In order to achieve the above purpose, the technical solutions provided by the embodiments of the present application are as follows:

[0006] In a first aspect, an embodiment of the present application provides an image enhancement model training method, the image enhancement model training method comprising: obtaining a training data set, the training data set comprising a plurality of image samples to be trained, and a pre-labeled attention area corresponding to each image sample to be trained;

[0007] Performing feature extraction on each of the image samples to be trained to obtain a text mask and a product object mask, wherein the text mask is used to indicate a text area in each of the image samples to be trained, and the product object mask is used to indicate a product area in each of the image samples to be trained;

[0008] Training a first multi-prompt network in an initial convolutional neural network by using the text mask and the training data set, and training a second multi-prompt network in the initial convolutional neural network by using the commodity object mask and the training data set, to obtain a target image enhancement model;

[0009] The first multi-hint network is used to enhance the quality of the image, and the second multi-hint network is used to redirect the attention of the image.

[0010] As an optional implementation, in the first aspect of the embodiment of the present application, the step of extracting features from each of the image samples to be trained to obtain a text mask and a commodity object mask includes:

[0011] Performing text extraction and image extraction on each of the image samples to be trained to obtain the text mask and the image mask;

[0012] Acquire task information input by a user, and determine text features according to the task information;

[0013] The commodity object mask is determined according to the cosine similarity between the image mask and the text feature.

[0014] As an optional implementation, in the first aspect of the embodiment of the present application, determining the commodity object mask according to the cosine similarity between the image mask and the text feature includes:

[0015] Calculating the cosine similarity between each image mask and the text feature;

[0016] The image mask with the highest cosine similarity is determined as the product object mask.

[0017] As an optional implementation, in the first aspect of the embodiment of the present application, the first multi-prompt network in the initial convolutional neural network is trained by the text mask and the training data set, and the second multi-prompt network in the initial convolutional neural network is trained by the commodity object mask and the training data set to obtain a target image enhancement model, including:

[0018] Inputting the text mask and the plurality of image samples to be trained into a first multi-prompt network to obtain a first visual prompt, and inputting the commodity object mask and the plurality of image samples to be trained into a second multi-prompt network to obtain a second visual prompt;

[0019] Inputting the first visual cue and the plurality of image samples to be trained into a backbone network and a first decoder network to obtain image samples after image enhancement;

[0020] Inputting the second visual cue and the image sample to be trained after the image enhancement into the backbone network and the second decoder network to obtain the image sample after the attention redirection, wherein the second decoder network includes a plurality of fully connected layers, and the plurality of fully connected layers respectively correspond to a plurality of parameters of the image editing operation;

[0021] According to the image samples after image enhancement and the image samples after attention redirection, the first multi-prompt network and the second multi-prompt network are trained respectively to obtain the target image enhancement model.

[0022] As an optional implementation manner, in the first aspect of the embodiment of the present application, inputting the text mask and the plurality of image samples to be trained into a first multi-cue network to obtain a first visual cue includes:

[0023] Inputting the text mask into a mask encoder in the first multi-cue network to obtain a first attention cue;

[0024] Inputting the plurality of to-be-trained image samples into a content encoder in the first multi-prompt network to obtain a first content prompt;

[0025] Obtaining a first task prompt according to the task information input by the user;

[0026] determining the first visual prompt according to the first attention prompt, the first content prompt, and the first task prompt;

[0027] And, inputting the commodity object mask and the plurality of image samples to be trained into a second multi-cue network to obtain a second visual cue, comprising:

[0028] Inputting the commodity object mask into a mask encoder in the second multi-cue network to obtain a second attention cue;

[0029] Inputting the plurality of to-be-trained image samples into a content encoder in the second multi-prompt network to obtain a second content prompt;

[0030] Obtaining a second task prompt according to the task information input by the user;

[0031] The second visual prompt is determined according to the second attention prompt, the second content prompt and the second task prompt.

[0032] As an optional implementation, in the first aspect of the embodiment of the present application, the first multi-prompt network and the second multi-prompt network are trained respectively according to the image sample after the image enhancement and the image sample after the attention redirection to obtain the target image enhancement model, including:

[0033] Determine a first loss function according to the image sample after image enhancement and the pre-annotated attention region corresponding to each image sample to be trained, and determine a second loss function according to the image sample after attention redirection and the pre-annotated attention region corresponding to each image sample to be trained;

[0034] The first multi-prompt network is optimized according to the first loss function, and the second multi-prompt network is optimized according to the second loss function to obtain the target image enhancement model.

[0035] As an optional implementation, in the first aspect of the embodiment of the present application, determining the second loss function according to the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained includes:

[0036] Determining a saliency loss according to a target attention region in the image sample after the attention redirection and a pre-labeled attention region corresponding to each image sample to be trained;

[0037] The target attention area in the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained are input into the authenticity evaluation network to obtain the authenticity loss;

[0038] The second loss function is determined according to the saliency loss and the authenticity loss.

[0039] In a second aspect, an embodiment of the present application provides an image enhancement model training device, the image enhancement model training device comprising: an acquisition module, used to acquire a training data set, the training data set comprising a plurality of image samples to be trained, and a pre-labeled attention area corresponding to each image sample to be trained;

[0040] A processing module, configured to perform feature extraction on each of the image samples to be trained to obtain a text mask and a product object mask, wherein the text mask is used to indicate a text area in each of the image samples to be trained, and the product object mask is used to indicate a product area in each of the image samples to be trained;

[0041] The processing module is further used to train a first multi-prompt network in the initial convolutional neural network through the text mask and the training data set, and to train a second multi-prompt network in the initial convolutional neural network through the commodity object mask and the training data set to obtain a target image enhancement model;

[0042] The first multi-hint network is used to enhance the quality of the image, and the second multi-hint network is used to redirect the attention of the image.

[0043] As an optional implementation, in the second aspect of the embodiment of the present application, the processing module is specifically used to perform text extraction and image extraction on each of the image samples to be trained to obtain the text mask and the image mask;

[0044] The processing module is specifically used to obtain task information input by the user and determine text features according to the task information;

[0045] The processing module is specifically configured to determine the commodity object mask according to the cosine similarity between the image mask and the text feature.

[0046] As an optional implementation, in the second aspect of the embodiment of the present application, the processing module is specifically used to calculate the cosine similarity between each image mask and the text feature;

[0047] The processing module is specifically configured to determine the product object mask according to the image mask with the highest cosine similarity.

[0048] As an optional implementation, in the second aspect of the embodiment of the present application, the processing module is specifically used to input the text mask and the multiple image samples to be trained into a first multi-prompt network to obtain a first visual prompt, and input the commodity object mask and the multiple image samples to be trained into a second multi-prompt network to obtain a second visual prompt;

[0049] The processing module is specifically used to input the first visual cue and the plurality of image samples to be trained into a backbone network and a first decoder network to obtain image samples after image enhancement;

[0050] The processing module is specifically used to input the second visual cue and the image sample to be trained after the image enhancement into the backbone network and the second decoder network to obtain the image sample after the attention redirection, wherein the second decoder network includes a plurality of fully connected layers, and the plurality of fully connected layers respectively correspond to a plurality of parameters of the image editing operation;

[0051] The processing module is specifically used to train the first multi-prompt network and the second multi-prompt network respectively according to the image samples after the image enhancement and the image samples after the attention redirection, so as to obtain the target image enhancement model.

[0052] As an optional implementation, in the second aspect of the embodiment of the present application, the processing module is specifically used to input the text mask into the mask encoder in the first multi-prompt network to obtain a first attention prompt;

[0053] The processing module is specifically configured to input the plurality of to-be-trained image samples into a content encoder in the first multi-prompt network to obtain a first content prompt;

[0054] The processing module is specifically used to obtain a first task prompt according to the task information input by the user;

[0055] The processing module is specifically configured to determine the first visual prompt according to the first attention prompt, the first content prompt and the first task prompt;

[0056] The processing module is specifically configured to input the commodity object mask into a mask encoder in the second multi-prompt network to obtain a second attention prompt;

[0057] The processing module is specifically configured to input the plurality of image samples to be trained into a content encoder in the second multi-prompt network to obtain a second content prompt;

[0058] The processing module is specifically configured to obtain a second task prompt according to the task information input by the user;

[0059] The processing module is specifically used to determine the second visual prompt according to the second attention prompt, the second content prompt and the second task prompt.

[0060] As an optional implementation, in the second aspect of the embodiment of the present application, the processing module is specifically used to determine a first loss function according to the image sample after image enhancement and the pre-annotated attention area corresponding to each image sample to be trained, and determine a second loss function according to the image sample after attention redirection and the pre-annotated attention area corresponding to each image sample to be trained;

[0061] The processing module is specifically used to optimize the first multi-prompt network according to the first loss function, and to optimize the second multi-prompt network according to the second loss function to obtain the target image enhancement model.

[0062] As an optional implementation, in the second aspect of the embodiment of the present application, the processing module is specifically used to determine the saliency loss according to the target attention area in the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained;

[0063] The processing module is specifically used to input the target attention area in the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained into the authenticity evaluation network to obtain the authenticity loss;

[0064] The processing module is specifically configured to determine the second loss function according to the significance loss and the authenticity loss.

[0065] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:

[0066] A memory storing executable program code;

[0067] a processor coupled to the memory;

[0068] The processor calls the executable program code stored in the memory to execute the image enhancement model training method in the first aspect of the embodiment of the present application.

[0069] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the image enhancement model training method in the first aspect of the embodiment of the present application. The computer-readable storage medium includes a ROM / RAM, a disk or an optical disk, etc.

[0070] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute part or all of the steps of any one of the methods of the first aspect.

[0071] In a sixth aspect, an embodiment of the present application provides an application publishing platform, which is used to publish a computer program product, wherein when the computer program product runs on a computer, the computer executes part or all of the steps of any one method of the first aspect.

[0072] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0073] The embodiment of the present application provides an image enhancement model training method, device, electronic device and storage medium, obtains a training data set, the training data set includes multiple image samples to be trained, and a pre-labeled attention area corresponding to each image sample to be trained; extracts features from each image sample to be trained to obtain a text mask and a commodity object mask, the text mask is used to indicate the text area in each image sample to be trained, and the commodity object mask is used to indicate the commodity area in each image sample to be trained; trains the first multi-prompt network in the initial convolutional neural network through the text mask and the training data set, and trains the second multi-prompt network in the initial convolutional neural network through the commodity object mask and the training data set to obtain a target image enhancement model; wherein the first multi-prompt network is used to enhance the quality of the image, and the second multi-prompt network is used to redirect the attention of the image. Through this scheme, a model that can simultaneously enhance the quality of the image and redirect the attention is obtained through training, and a multi-prompt network is added to the model, which can simultaneously pay attention to the attention area, task details and image content, significantly improving the transfer learning efficiency and generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

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

[0076] Figure 1 This is a flow chart of an image enhancement model training method provided in an embodiment of the present application. Figure 1 ;

[0077] Figure 2 This is a flow chart of an image enhancement model training method provided in an embodiment of the present application. Figure 2 ;

[0078] Figure 3 This is a model diagram of an image enhancement model training method provided in an embodiment of the present application. Figure 1 ;

[0079] Figure 4 This is a flow chart of an image enhancement model training method provided in an embodiment of the present application. Figure 3 ;

[0080] Figure 5This is a model diagram of an image enhancement model training method provided in an embodiment of the present application. Figure 2 ;

[0081] Figure 6 This is a model diagram of an image enhancement model training method provided in an embodiment of the present application. Figure 3 ;

[0082] Figure 7 It is a result schematic diagram of an image enhancement model training method provided in an embodiment of the present application;

[0083] Figure 8 It is a structural schematic diagram of an image enhancement model training device provided in an embodiment of the present application;

[0084] Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0086] The terms “first”, “second” and the like in the description and claims of the present application are used to distinguish different objects rather than to describe a specific order of the objects.

[0087] The terms "including" and "having" and any variations thereof in the embodiments of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.

[0088] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0089] With the popularity of online shopping, e-commerce images play an important role in product display and consumer attraction. However, due to the limitations of online storage and bandwidth, e-commerce images usually need to be compressed, resulting in reduced image quality, unclear product details and advertising text, etc. In addition, the key products in some images are not prominent enough to effectively attract consumers' attention. These problems limit the practicality and advertising value of e-commerce images.

[0090] In the field of image processing, researchers have proposed a variety of techniques to improve image quality. For example, the SwinIR algorithm uses the Swin Transformer structure to effectively restore images from various degradation problems in images, such as noise and blur. SwinIR improves the quality of restored images by utilizing local and global features during the image restoration process, especially in terms of maintaining details and textures.

[0091] Another related research is the Realistic Saliency Guided Image Enhancement method, which focuses on the redirection of image attention. By adjusting the distribution of saliency in the image, this method can guide the viewer's visual attention to make the key areas of the image more prominent. This method improves the visual appeal of the image by optimizing the saliency map, making important information more eye-catching.

[0092] Although existing methods have achieved certain results in processing natural images, there are limitations in the application of these technologies to e-commerce image processing. The particularity of e-commerce images is that they usually contain product-oriented layouts and product-related text, which are essential for conveying product information. However, existing image processing techniques are not optimized for these specific elements, resulting in the inability to effectively preserve product details and clarity when processing e-commerce images while ensuring the readability of text information.

[0093] In addition, key products in e-commerce images usually need to be more prominent to attract consumers' attention, while existing attention redirection techniques mainly target natural images and lack specialized processing of product saliency in e-commerce images. As a result, important product features may not be properly emphasized in e-commerce images, thereby reducing the advertising effect of the image and consumers' willingness to buy.

[0094] The data size of high-quality e-commerce images is relatively small, and it is difficult to obtain a large number of images with real enhancement and attention redirection annotations. This data scarcity limits the application of deep learning methods for e-commerce image enhancement, because these methods usually require a large amount of annotated data to train effective models. The lack of sufficient training data not only affects the performance of the model, but also limits the ability of the algorithm to generalize to different types of e-commerce images.

[0095] Therefore, the defects of existing technologies mainly stem from their inability to fully adapt to the specific needs of e-commerce images and the lack of sufficient high-quality e-commerce image data to support and optimize image processing algorithms. These limiting factors together lead to unsatisfactory processing effects in terms of quality improvement and attention guidance of e-commerce images.

[0096] In order to solve some or all of the above technical problems, the embodiment of the present application provides an image enhancement model training method, device, electronic device and storage medium, obtain a training data set, the training data set includes multiple image samples to be trained, and a pre-annotated attention area corresponding to each image sample to be trained; feature extraction is performed on each image sample to be trained to obtain a text mask and a commodity object mask, the text mask is used to indicate the text area in each image sample to be trained, and the commodity object mask is used to indicate the commodity area in each image sample to be trained; the first multi-prompt network in the initial convolutional neural network is trained by the text mask and the training data set, and the second multi-prompt network in the initial convolutional neural network is trained by the commodity object mask and the training data set to obtain a target image enhancement model; wherein the first multi-prompt network is used to enhance the quality of the image, and the second multi-prompt network is used to redirect the attention of the image. Through this scheme, a model that can simultaneously enhance the quality of the image and redirect the attention is obtained through training, and a multi-prompt network is added to the model, which can simultaneously pay attention to the attention area, task details and image content, significantly improving the transfer learning efficiency and generalization ability of the model.

[0097] like Figure 1 As shown, Figure 1 A flowchart of an image enhancement model training method provided in an embodiment of the present application, the method may include the following steps:

[0098] 101. Obtain a training dataset.

[0099] In an embodiment of the present application, the training data set may include: multiple image samples to be trained, and pre-annotated attention areas corresponding to each image sample to be trained. The image sample to be trained may be an e-commerce image, which includes a variety of information such as product image, product name, product introduction, etc.; the pre-annotated attention areas may be annotated by the staff in advance on the image sample to be trained. Based on the characteristics of e-commerce images, in order to display products and attract consumers, some areas in the image need to be enhanced or enlarged for display, etc. Therefore, in order to train the model, the staff can pre-annotate the samples, that is, mark the attention areas that need to be highlighted in the image sample to be trained.

[0100] 102. Perform feature extraction on each image sample to be trained to obtain a text mask and a product object mask.

[0101] In an embodiment of the present application, feature extraction can be performed on each image sample to be trained. Since the image sample to be trained includes text content and image content, they are extracted separately to obtain a text mask and a product object mask, wherein the text mask is used to indicate the text area in each image sample to be trained, and the product object mask is used to indicate the product area in each image sample to be trained.

[0102] It should be noted that image masking is to use a selected image, graphic or object to block the image to be processed (all or part) to control the area or process of image processing. In image processing, the mask is usually a binary or Boolean image of the same size as the original image, in which the selected area is marked as 1 (or True) and the rest of the area is marked as 0 (or False).

[0103] In digital image processing, a mask is a two-dimensional matrix array, sometimes also a multi-value image. It can be mainly used for: extracting the region of interest: multiplying the pre-made region of interest mask with the image to be processed to obtain the region of interest image, where the image value in the region of interest remains unchanged, and the image value outside the region is 0; and, shielding: using a mask to shield certain areas on the image so that they do not participate in the processing or the calculation of processing parameters, or only processing or statistics on the shielded area; and, structural feature extraction: using similarity variables or image matching methods to detect and extract structural features in the image that are similar to the mask; and, the production of special shape images: using a mask to define a region of a specific shape and process it to generate an image of a specific shape.

[0104] In addition, when using masks for image processing, it is important to note that the mask must have the same size and resolution as the original image, and the 1-value area in the mask represents the area that needs to be processed, while the 0-value area represents the area that does not need to be processed. Also, when using masks for image processing, it is necessary to select appropriate operations (such as filtering, edge detection, region extraction, etc.) according to specific needs.

[0105] In some embodiments, feature extraction is performed on each image sample to be trained to obtain a text mask and a product object mask, which can be specifically performed by Figure 2 The steps 1021 to 1023 shown are implemented.

[0106] 1021. Perform text extraction and image extraction on each image sample to be trained to obtain a text mask and an image mask.

[0107] 1022. Obtain task information input by the user, and determine text features according to the task information.

[0108] 1023. Determine the product object mask according to the cosine similarity between the image mask and the text feature.

[0109] In an embodiment of the present application, the above steps can be specifically implemented by an interactive condition unit, which enables the user to specify the required object and then generates a corresponding attention area, which can associate the user-specific product name with the image area of ​​different objects.

[0110] In some embodiments, Figure 3 As shown in the interactive conditional unit, each image sample to be trained is input into the attention generator to generate a text mask M t as the text attention (i.e., text mask), and N dominant object masks (i.e., image mask). Then, the image mask can be input to the image encoder E img To extract visual features Specifically, it can be expressed as:

[0111]

[0112] Among them, I is the input image (image sample to be trained), ⊙ represents element-by-element multiplication, and element-by-element multiplication (also called element-wise multiplication or Hadamard product) is an operation between two matrices or arrays of the same shape, where each element of the output array is the product of the corresponding elements of the input array. This is very useful in many mathematical and computing applications, especially in deep learning, image processing, and other types of matrix calculations.

[0113] Meanwhile, for the text aspect, the user-specific product name is used to construct a designed prompt template, such as “a product photo of [name]”, which is then input into the text encoder E text To extract text features f text :

[0114] f text =E text ("aproductphotoof[name]")

[0115] In some embodiments, the above-mentioned prompt templates can include multiple formats. In order to compare the performance of different prompt templates, the mean recall rate (mAR), recall rate (R) and precision (P) can be used to measure the difference between the generated object focus area and the annotated product. For comparison, a simple convolutional binary classifier is introduced, which is trained to determine whether each input object mask is a product or other. As shown in Table 1, the interactive chart proposed by this method performs better than the baseline model. In addition, the template "a product photo of [name]" can promote the interactive conditional module of this method to achieve the best performance, so this template is finally selected in this method.

[0116] Table 1 Performance comparison results of different prompt templates

[0117]

[0118] In obtaining the text features f of a user-specific object text and the visual features of all object candidates After that, the cosine similarity score is calculated to match the object mask to the product name. Here, since the content input by the user can become the task information, that is, the content that the user needs to focus on, the text features are determined according to the task information, and then the visual features and text features are compared in turn to determine the closest visual features to obtain the product object mask.

[0119] In some embodiments, specifically, the cosine similarity between each image mask and the text feature is calculated; and the image mask with the highest cosine similarity is determined as the product object mask.

[0120] It should be noted that since the image mask has been converted into a visual feature after passing through the image encoder, the cosine similarity between each visual feature and the text feature can be calculated, and then the visual feature with the highest cosine similarity is selected, and the image mask corresponding to the visual feature is determined as the product object mask.

[0121] Specifically, the cosine similarity can be expressed as:

[0122]

[0123] Among them, ⊙ represents element-by-element multiplication, ‖·‖ represents the Euclidean norm, which is also called the 2-norm or L2-norm. It is a distance metric widely used in mathematics and computer science. It is used to measure the similarity between vectors and is specifically defined as the length of a vector, that is, the square root of the sum of the squares of the elements of the vector. For an n-dimensional vector x = (x1, x2, ..., xn), the calculation formula for its Euclidean norm is:

[0124] ||x||2=sqrt(x1 2 +x2 2 +…+x n 2 )

[0125] Here, ||x||2 represents the Euclidean norm of vector x.

[0126] The Euclidean norm has the following properties: Non-negativity: For any vector x, the Euclidean norm is always non-negative. Ternary property: For any vector x and real number c, the Euclidean norm of c·x is equal to the Euclidean norm of |c|·x. Homogeneity: Similar to ternary property, for any vector x and real number c, the Euclidean norm of x is equal to the Euclidean norm of |c|·x. Inverse symmetry: For any vector x and y, the Euclidean norm of x is equal to the Euclidean norm of y if and only if x and y are opposite vectors. It should be noted that the Euclidean norm may also be 0 when there are 0 elements in the vector.

[0127] 103. Train a first multi-prompt network in the initial convolutional neural network using the text mask and the training data set, and train a second multi-prompt network in the initial convolutional neural network using the product object mask and the training data set to obtain a target image enhancement model.

[0128] In the embodiment of the present application, unlike the single visual cue used in most existing methods, the present application proposes a multi-cue network to learn enhanced visual cues, including three types of cues: attention cues, content cues, and task cues. In this way, the attention area, task details, and image content can be embedded to prompt the downstream tasks of the quality enhancement unit and the attention redirection unit. This significantly improves the transfer learning efficiency and generalization ability of the proposed method.

[0129] In some embodiments, the initial convolutional neural network includes a quality enhancement unit and an attention redirection unit, the quality enhancement unit includes a first multi-prompt network, and the attention redirection unit includes a second multi-prompt network, which are respectively used to perform quality enhancement and attention redirection on the image.

[0130] In some embodiments, the first multi-prompt network in the initial convolutional neural network is trained by the text mask and the training data set, and the second multi-prompt network in the initial convolutional neural network is trained by the commodity object mask and the training data set to obtain the target image enhancement model, which can be specifically obtained by Figure 4 The steps 1031 to 1034 shown are implemented.

[0131] 1031. Input the text mask and multiple image samples to be trained into a first multi-prompt network to obtain a first visual prompt, and input the commodity object mask and multiple image samples to be trained into a second multi-prompt network to obtain a second visual prompt.

[0132] In the embodiment of the present application, the first multi-prompt network and the second multi-prompt network are essentially the same, both of which merge multiple prompts into visual prompts, but the specific input contents are different.

[0133] Combine the attention mask M in the interactive conditional unit v (M p or M t ), generate attention cues to indicate the attention areas of subsequent quality enhancement units and attention redirection units.

[0134] In some embodiments, the generation process of the first visual cue and the second visual cue is similar, wherein a text mask is input into a mask encoder in a first multi-cue network to obtain a first attention cue; a plurality of image samples to be trained are input into a content encoder in the first multi-cue network to obtain a first content cue; a first task cue is obtained based on task information input by a user; a first visual cue is determined based on the first attention cue, the first content cue and the first task cue; and a commodity object mask is input into a mask encoder in a second multi-cue network to obtain a second attention cue; a plurality of image samples to be trained are input into a content encoder in the second multi-cue network to obtain a second content cue; a second task cue is obtained based on the task information input by the user; a second visual cue is determined based on the second attention cue, the second content cue and the second task cue.

[0135] In some embodiments, Figure 5 As shown, a novel residual block E is designed with two Res The residual structure of att :

[0136] Patt =E UP (E Res (M v ))+M v

[0137] In the formula, E UP is an upsampling layer with pixel shuffling operations to restore the size of the input image. v Specifically, it may include text masks and product object masks. The input to the first multi-prompt network is the text mask, and the input to the second multi-prompt network is the product object mask.

[0138] Depend on Figure 5 It can be seen that the mask input to the multi-hint network is actually processed by the mask encoder, which includes two sets of convolutional layers (residual structure) and upsampling layers, and finally obtains the attention hint.

[0139] In some embodiments, the content prompt P cont ∈R H×W×3 is generated to improve the generalization ability of the backbone network. Specifically, the content hint is generated through a series of convolutional layers E VGG Extracted, specific, content prompts P cont It can be expressed as:

[0140] P cont =E UP (E VGG (I)),

[0141] Among them, E UP Same as the upsampling layer in the attention cue. Figure 5 It can be seen that multiple image samples to be trained are input into the multi-prompt network and are actually processed by the content encoder, which includes multiple groups of convolutional layers, upsampling layers and activation functions, and finally obtains the content prompt.

[0142] In some embodiments, the task prompt P is defined task ∈R H×W×3 As a learnable parameter, its size is the same as the input image. In this way, task information can be encoded to prompt the frozen backbone network to perform different tasks, namely the quality enhancement unit and the attention redirection unit.

[0143] Depend on Figure 5 It can be seen that the task prompt P task It is directly generated. The task prompt is actually obtained based on the task information input by the user.

[0144] Finally, the above three prompts (content prompt, task prompt, attention prompt) are combined into the final visual prompt Pv , which can be specifically expressed as:

[0145] P v =P task +λ·P cont +γ·P att

[0146] In the formula, + represents element-by-element addition, and λ and γ are the weights of the corresponding prompts.

[0147] In some embodiments, the effectiveness of the multi-hint network for quality enhancement is further studied through three ablation experiments: (1) without content cues; (2) without content and attention cues; (3) without multi-hint network. The experimental results are shown in Table 2. It can be seen that when the entire multi-hint network is removed, the PSNR drops by 0.15dB. At the same time, removing the content cues and attention cues leads to a PSNR drop of 0.03dB and 0.06dB, respectively. Similar results can be found in terms of SSIM and LPIPS. This shows that the developed hint-based framework contributes to the final performance of our method.

[0148] Table 2 Performance comparison results of various cue ablations

[0149] Modules PSNR SSIM LPIPS Full model 32.53 0.925 0.178 w / o content prompt 32.50 0.925 0.181 w / o content & attention prompt 32.44 0.924 0.180 w / o multi-prompt net 32.38 0.924 0.180

[0150] 1032. Input the first visual cue and a plurality of image samples to be trained into the backbone network and the first decoder network to obtain image samples after image enhancement.

[0151] In the embodiment of the present application, the backbone network E back , the first decoder network D QE Together with the first multi-hint network, they form a quality enhancement unit, which is designed to improve the objective quality of compressed e-commerce images. back is pre-trained and frozen, and consists of a set of Swin Transformer blocks and convolutional layers. In addition, the first decoder network D QE It is lightweight, has two convolutional layers, and is trainable.

[0152] Specifically, the structure of the quality enhancement unit is as follows: Figure 6 As shown, the image sample I and the visual cue P QE (obtained from the multi-hint network) are combined and fed into the pre-trained backbone network for feature extraction. Subsequently, the extracted features are fed into the decoder to reconstruct high-quality e-commerce images Specifically, it can be expressed as:

[0153]

[0154] 1033. Input the second visual cue and the image sample to be trained after image enhancement into the backbone network and the second decoder network to obtain the image sample after attention redirection. The second decoder network includes multiple fully connected layers, and the multiple fully connected layers correspond to multiple parameters of the image editing operation respectively.

[0155] In the embodiment of the present application, the backbone network E back , the first decoder network D AR The attention redirection unit and the second multi-hint network together form the attention redirection unit, which improves the saliency of the desired object by performing pixel-level operations in the object area. It can be seen that the attention redirection unit and the quality enhancement unit use the same backbone network E back ,Different from the quality enhancement unit, the decoder of the attention redirection unit includes global average pooling and five fully connected layers.,Here, each fully connected layer learns the parameters of the image editing,operation, including the adjustment of color, saturation, contrast, white balance, and sharpness.,Then, these parameters are used to manipulate the object region through the,corresponding traditional image processing methods.

[0156] Specifically, the structure of the attention redirection unit is as follows Figure 6 As shown, according to the output image of the quality enhancement unit and the learned visual cue P AR , and get the final output image It can be expressed as:

[0157]

[0158] 1034. According to the image samples after image enhancement and the image samples after attention redirection, the first multi-prompt network and the second multi-prompt network are trained respectively to obtain a target image enhancement model.

[0159] In an embodiment of the present application, in order to optimize the model, the first multi-prompt network and the second multi-prompt network in the quality enhancement unit and the attention redirection unit can be trained and optimized respectively to obtain the final target image enhancement model.

[0160] In some embodiments, a first loss function is determined based on the image samples after image enhancement and the pre-labeled attention areas corresponding to each image sample to be trained, and a second loss function is determined based on the image samples after attention redirection and the pre-labeled attention areas corresponding to each image sample to be trained; the first multi-prompt network is optimized according to the first loss function, and the second multi-prompt network is optimized according to the second loss function to obtain a target image enhancement model.

[0161] It should be noted that in order to train the quality enhancement module, the original image I rawand enhanced images Specifically, the quality enhancement loss (The first loss function) can be expressed as:

[0162]

[0163] Among them, ∈ is a constant factor with a value of 1×10 -3 After obtaining the loss function, the parameters of the first multi-prompt network can be optimized, and the training can be continued, and the optimization can be continuously performed until convergence.

[0164] It should be noted that in order to obtain realistic results with the desired saliency distribution, the attention redirection loss is designed To supervise the AR module. However, different from the optimization method of the first multi-hint network in the quality enhancement unit, the optimization of the second multi-hint network in the attention redirection unit mainly considers two factors: the saliency change ΔS and the authenticity change ΔR between the input and edited images.

[0165] In some embodiments, a saliency loss is determined based on a target attention area in an image sample after attention redirection and a pre-annotated attention area corresponding to each image sample to be trained; the target attention area in the image sample after attention redirection and the pre-annotated attention area corresponding to each image sample to be trained are input into an authenticity evaluation network to obtain an authenticity loss; and a second loss function is determined based on the saliency loss and the authenticity loss.

[0166] Specifically, the saliency change ΔS represents the average difference between the saliency maps of the input and edited images in the attention region:

[0167]

[0168] Among them, E[·] is the expected function, E sal (·) is a deep saliency prediction model.

[0169] Furthermore, the change in authenticity ΔR is expressed as:

[0170]

[0171] Among them, E rel (·) is a authenticity evaluation network containing multiple convolutional layers and fully connected layers, and s is a preset offset. In order to optimize both saliency and authenticity, the above saliency change ΔS and authenticity change ΔR can be mixed to obtain a second loss function to optimize the second multi-hint network.

[0172] Specifically, attention redirection loss (The second loss function) can be expressed as:

[0173]

[0174] Among them, w s It is a hyperparameter used to adjust the degree of significance and realism change.

[0175] The present application provides an image enhancement model training method, which obtains a training data set, which includes multiple image samples to be trained and a pre-labeled attention area corresponding to each image sample to be trained; extracts features from each image sample to be trained to obtain a text mask and a product object mask, wherein the text mask is used to indicate the text area in each image sample to be trained, and the product object mask is used to indicate the product area in each image sample to be trained; trains the first multi-prompt network in the initial convolutional neural network through the text mask and the training data set, and trains the second multi-prompt network in the initial convolutional neural network through the product object mask and the training data set to obtain a target image enhancement model; wherein the first multi-prompt network is used to enhance the quality of the image, and the second multi-prompt network is used to redirect the attention of the image. Through this scheme, a model that can simultaneously enhance the quality of the image and redirect the attention is obtained through training, and a multi-prompt network is added to the model, which can simultaneously pay attention to the attention area, task details and image content, significantly improving the transfer learning efficiency and generalization ability of the model.

[0176] In some embodiments, during the training process of the target image enhancement model, an Adam optimizer and an initial learning rate of 2×10 -3 The quality enhancement unit and the attention redirection unit are optimized. In addition, a multi-step schedule is applied to automatically adjust the learning rate. For the multi-hint network, both λ and γ are set to 1. For the quality enhancement unit, the patch size is set to 126×126. For the attention redirection unit, the input image is resized to 384×384 to generate the editing parameters, which are then applied to the original image. s and w in the loss function of the attention redirection unit s The values ​​of are set to 0.25 and 0.3 respectively. All experiments are conducted on a server equipped with two NVIDIA 4090 GPUs.

[0177] In addition, to train the model, this method randomly selected 871 and 350 images from the database as training and validation sets. For the inference stage, this method used the remaining 311 images in the database as the test set. At the same time, in order to evaluate the generalization ability of this method, 324 and 321 test images were randomly selected from the M5Product database and K3M database. Similar to the database proposed by this method, the e-commerce images in M5Product and K3M are also compressed using the JPEG codec with QF values ​​of 10, 20, 30, and 40. To evaluate attention redirection, this method further manually annotated the attention regions in M5Product and K3M, which are the same as the annotations in the database of this method.

[0178] Furthermore, the proposed method is compared with several other learning-based quality enhancement methods, including SwinIR, MIRNet-v2, DnCNN, and DCAD. All compared methods are retrained and evaluated on the same data as the proposed method. Subsequently, the quality enhancement performance of the proposed method and the compared methods is evaluated by three indicators, including Peak Signal to Noise Ratio (PSNR), structural similarity index measurement (SSIM), and learned perceptual image patch similarity (LPIPS). Note that higher PSNR and SSIM, and lower LPIPS indicate better quality. The results of the three databases under four QF values ​​are shown in Table 3. It can be observed that the proposed method achieves the best performance in all three databases with PSNR, SSIM, and LPIPS as indicators. For example, in the proposed database, the proposed method improves the PSNR by 0.03dB, 0.1dB, and 0.16dB compared to the second best method when QF is 10, 20, and 40, respectively. This verifies the effectiveness of the proposed method in quality enhancement. More importantly, this method also achieved the highest image quality on the M5Product and K3M databases, indicating that this method has good generalization ability on multiple databases.

[0179] Table 3 Performance comparison of different methods on multiple databases

[0180]

[0181] In addition, two best-performing quality enhancement methods and two state-of-the-art attention redirection methods are selected and their combination is used as the baseline method. Specifically, based on the results in Table 1, SwinIR and MIRNet-v2 are selected for quality enhancement. For attention redirection, two learning-based attention redirection methods are adopted: RelEn and GazeShift. For quantitative comparison, a user study is conducted to evaluate the performance of our method and the baseline methods. Specifically, 105 images are randomly selected from three databases and enhanced by our method and the baseline methods respectively. Next, the images enhanced by different methods are randomly presented together with the original images, and 20 volunteers are recruited to select the best enhanced image overall, considering the following aspects in the selection process: (1) the overall image quality is enhanced; (2) the product area is more prominent than the original image; (3) the enhanced image looks realistic. Then, the selection ratio of each method is calculated. As shown in Table 4 below, in our method's database, our method has a selection rate of 62.14%, which is significantly better than the second best baseline SwinIR and RelEn of 13.14%. At the same time, in the other two databases, the proposed method also achieved excellent results of 56.85% and 52.71% respectively. This proves the effectiveness of the proposed method in quality enhancement and attention redirection of e-commerce images. Figure 7 As shown, the mask results and processing results of this method and various baseline methods for input images of different databases are shown.

[0182] Table 4 Subjective selection rates of multiple users for multiple methods and multiple databases

[0183] Approach Datasets for this method M5Product K3M SwinIR+RelEn 13.14% 14.42% 16.14% SwinIR+GazeShift 5.28% 7.28% 7.00% MIRNet-v2+RelEn 13.00% 16.42% 16.85% MIRNet-v2+GazeShift 6.42% 5.00% 7.71% This method 62.14% 56.85% 52.71%

[0184] like Figure 8 As shown, an embodiment of the present application provides an image enhancement model training device, which may include:

[0185] An acquisition module 801 is used to acquire a training data set, where the training data set includes a plurality of image samples to be trained and a pre-labeled attention area corresponding to each image sample to be trained;

[0186] The processing module 802 is used to extract features from each image sample to be trained to obtain a text mask and a product object mask, wherein the text mask is used to indicate a text area in each image sample to be trained, and the product object mask is used to indicate a product area in each image sample to be trained;

[0187] The processing module 802 is further used to train a first multi-prompt network in the initial convolutional neural network through the text mask and the training data set, and to train a second multi-prompt network in the initial convolutional neural network through the commodity object mask and the training data set to obtain a target image enhancement model;

[0188] Among them, the first multi-hint network is used to enhance the quality of the image, and the second multi-hint network is used to redirect the attention of the image.

[0189] In some embodiments, the processing module 802 is specifically used to perform text extraction and image extraction on each image sample to be trained to obtain a text mask and an image mask;

[0190] The processing module 802 is specifically used to obtain the task information input by the user and determine the text features according to the task information;

[0191] The processing module 802 is specifically configured to determine a product object mask according to the cosine similarity between the image mask and the text feature.

[0192] In some embodiments, the processing module 802 is specifically configured to calculate the cosine similarity between each image mask and the text feature;

[0193] The processing module 802 is specifically configured to determine the image mask with the highest cosine similarity as the product object mask.

[0194] In some embodiments, the processing module 802 is specifically configured to input the text mask and the plurality of image samples to be trained into a first multi-prompt network to obtain a first visual prompt, and input the commodity object mask and the plurality of image samples to be trained into a second multi-prompt network to obtain a second visual prompt;

[0195] The processing module 802 is specifically used to input the first visual cue and the plurality of image samples to be trained into the backbone network and the first decoder network to obtain image samples after image enhancement;

[0196] The processing module 802 is specifically used to input the second visual cue and the image sample to be trained after the image enhancement into the backbone network and the second decoder network to obtain the image sample after the attention redirection, wherein the second decoder network includes a plurality of fully connected layers, and the plurality of fully connected layers respectively correspond to a plurality of parameters of the image editing operation;

[0197] The processing module 802 is specifically used to train the first multi-prompt network and the second multi-prompt network respectively according to the image samples after image enhancement and the image samples after attention redirection to obtain a target image enhancement model.

[0198] In some embodiments, the processing module 802 is specifically configured to input the text mask into a mask encoder in a first multi-cue network to obtain a first attention cue;

[0199] The processing module 802 is specifically configured to input a plurality of image samples to be trained into a content encoder in a first multi-prompt network to obtain a first content prompt;

[0200] The processing module 802 is specifically configured to obtain a first task prompt according to the task information input by the user;

[0201] The processing module 802 is specifically configured to determine a first visual prompt according to the first attention prompt, the first content prompt and the first task prompt;

[0202] The processing module 802 is specifically configured to input the product object mask into a mask encoder in a second multi-cue network to obtain a second attention cue;

[0203] The processing module 802 is specifically configured to input a plurality of to-be-trained image samples into a content encoder in a second multi-prompt network to obtain a second content prompt;

[0204] The processing module 802 is specifically used to obtain a second task prompt according to the task information input by the user;

[0205] The processing module 802 is specifically configured to determine a second visual prompt according to the second attention prompt, the second content prompt and the second task prompt.

[0206] In some embodiments, the processing module 802 is specifically configured to determine a first loss function according to the image sample after image enhancement and the pre-annotated attention region corresponding to each image sample to be trained, and determine a second loss function according to the image sample after attention redirection and the pre-annotated attention region corresponding to each image sample to be trained;

[0207] The processing module 802 is specifically used to optimize the first multi-prompt network according to the first loss function, and optimize the second multi-prompt network according to the second loss function to obtain a target image enhancement model.

[0208] In some embodiments, the processing module 802 is specifically configured to determine the saliency loss according to the target attention region in the image sample after the attention redirection and the pre-labeled attention region corresponding to each image sample to be trained;

[0209] Processing module 802 is specifically used to input the target attention area in the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained into the authenticity evaluation network to obtain the authenticity loss;

[0210] The processing module 802 is specifically configured to determine a second loss function according to the saliency loss and the authenticity loss.

[0211] In the embodiments of the present application, each module can implement the image enhancement model training method provided in the above method embodiments and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0212] like Fig. 9 As shown, an embodiment of the present application further provides an electronic device, which may include:

[0213] A memory 901 storing executable program codes;

[0214] A processor 902 coupled to the memory 901;

[0215] Among them, the processor 902 calls the executable program code stored in the memory 901 to execute the image enhancement model training method performed by the electronic device in the above-mentioned method embodiments.

[0216] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the image enhancement model training method in the above method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0217] An embodiment of the present application also provides a computer program product, which stores a computer program. When the computer program is executed by a processor, the various processes of the image enhancement model training method in the above method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0218] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.

[0219] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0220] In the present application, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0221] In this application, 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. Memory is an example of a computer-readable medium.

[0222] In this application, a person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, and the computer-readable medium includes permanent and non-permanent, removable and non-removable storage media. The storage medium can implement information storage by any method or technology, and the information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of computer storage media include, but are not limited to, Parallel Random Access Memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Programmable Read-only Memory (PROM), Erasable Programmable Read Only Memory (EPROM), other types of Random Access Memory (RAM), Read-Only Memory (ROM), One-time Programmable Read-Only Memory (OTPROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0223] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0224] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application. The above-mentioned multiple embodiments are not necessarily multiple independent embodiments. Dividing into multiple embodiments is only used to highlight the different technical features in different embodiments. Those skilled in the art should be aware that the above-mentioned multiple embodiments can also be combined in any way.

[0225] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0226] The units described above 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 network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0227] In addition, each functional unit in each embodiment of the present application 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.

[0228] If the above-mentioned 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-accessible memory. Based on this understanding, the technical solution of the present application, 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, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the above-mentioned methods of various embodiments of the present application.

[0229] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for training an image enhancement model, characterized in that: The method comprises: Acquire a training data set, wherein the training data set includes a plurality of image samples to be trained and a pre-labeled attention area corresponding to each image sample to be trained; Performing feature extraction on each of the image samples to be trained to obtain a text mask and a product object mask, wherein the text mask is used to indicate a text area in each of the image samples to be trained, and the product object mask is used to indicate a product area in each of the image samples to be trained; Training a first multi-prompt network in an initial convolutional neural network by using the text mask and the training data set, and training a second multi-prompt network in the initial convolutional neural network by using the commodity object mask and the training data set, to obtain a target image enhancement model; The first multi-hint network is used to enhance the quality of the image, and the second multi-hint network is used to redirect the attention of the image.

2. The method according to claim 1, characterized in that: The step of extracting features from each of the image samples to be trained to obtain a text mask and a commodity object mask includes: Performing text extraction and image extraction on each of the image samples to be trained to obtain the text mask and the image mask; Acquire task information input by a user, and determine text features according to the task information; The commodity object mask is determined according to the cosine similarity between the image mask and the text feature.

3. The method according to claim 2, characterized in that The step of determining the commodity object mask according to the cosine similarity between the image mask and the text feature comprises: Calculating the cosine similarity between each image mask and the text feature; The image mask with the highest cosine similarity is determined as the product object mask.

4. The method according to claim 1, characterized in that The step of training a first multi-prompt network in an initial convolutional neural network by using the text mask and the training data set, and training a second multi-prompt network in the initial convolutional neural network by using the commodity object mask and the training data set, to obtain a target image enhancement model, comprises: Inputting the text mask and the plurality of image samples to be trained into a first multi-prompt network to obtain a first visual prompt, and inputting the commodity object mask and the plurality of image samples to be trained into a second multi-prompt network to obtain a second visual prompt; Inputting the first visual cue and the plurality of image samples to be trained into a backbone network and a first decoder network to obtain image samples after image enhancement; Inputting the second visual cue and the image sample to be trained after the image enhancement into the backbone network and the second decoder network to obtain the image sample after the attention redirection, wherein the second decoder network includes a plurality of fully connected layers, and the plurality of fully connected layers respectively correspond to a plurality of parameters of the image editing operation; According to the image samples after image enhancement and the image samples after attention redirection, the first multi-prompt network and the second multi-prompt network are trained respectively to obtain the target image enhancement model.

5. The method according to claim 4, characterized in that The step of inputting the text mask and the plurality of image samples to be trained into a first multi-cue network to obtain a first visual cue comprises: Inputting the text mask into a mask encoder in the first multi-cue network to obtain a first attention cue; Inputting the plurality of to-be-trained image samples into a content encoder in the first multi-prompt network to obtain a first content prompt; Obtaining a first task prompt according to the task information input by the user; determining the first visual prompt according to the first attention prompt, the first content prompt, and the first task prompt; And, inputting the commodity object mask and the plurality of image samples to be trained into a second multi-cue network to obtain a second visual cue, comprising: Inputting the commodity object mask into a mask encoder in the second multi-cue network to obtain a second attention cue; Inputting the plurality of to-be-trained image samples into a content encoder in the second multi-prompt network to obtain a second content prompt; Obtaining a second task prompt according to the task information input by the user; The second visual prompt is determined according to the second attention prompt, the second content prompt and the second task prompt.

6. The method according to claim 4, characterized in that The step of training the first multi-prompt network and the second multi-prompt network respectively according to the image samples after image enhancement and the image samples after attention redirection to obtain the target image enhancement model includes: Determine a first loss function according to the image sample after image enhancement and the pre-annotated attention region corresponding to each image sample to be trained, and determine a second loss function according to the image sample after attention redirection and the pre-annotated attention region corresponding to each image sample to be trained; The first multi-prompt network is optimized according to the first loss function, and the second multi-prompt network is optimized according to the second loss function to obtain the target image enhancement model.

7. The method according to claim 6, characterized in that The determining of the second loss function according to the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained includes: Determining a saliency loss according to a target attention region in the image sample after the attention redirection and a pre-labeled attention region corresponding to each image sample to be trained; The target attention area in the image sample after the attention redirection and the pre-labeled attention area corresponding to each image sample to be trained are input into the authenticity evaluation network to obtain the authenticity loss; The second loss function is determined according to the saliency loss and the authenticity loss.

8. An image enhancement model training device, characterized in that: include: An acquisition module is used to acquire a training data set, wherein the training data set includes a plurality of image samples to be trained and a pre-labeled attention area corresponding to each image sample to be trained; A processing module, configured to perform feature extraction on each of the image samples to be trained to obtain a text mask and a product object mask, wherein the text mask is used to indicate a text area in each of the image samples to be trained, and the product object mask is used to indicate a product area in each of the image samples to be trained; The processing module is further used to train a first multi-prompt network in the initial convolutional neural network through the text mask and the training data set, and to train a second multi-prompt network in the initial convolutional neural network through the commodity object mask and the training data set to obtain a target image enhancement model; The first multi-hint network is used to enhance the quality of the image, and the second multi-hint network is used to redirect the attention of the image.

9. An electronic device, characterized in that: include: A memory storing executable program code; and a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the image enhancement model training method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by the processor, the image enhancement model training method as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Vehicle fine-grained identification method and device

    CN111126459A

  • Image quality enhancement method based on channel attention mechanism

    CN113160198A

  • Method and device for training image processing model and image processing

    CN115641481A

  • Zero sample semantic segmentation method based on thermodynamic diagram and self-attention module

    CN116486078A

  • Certificate classification method, device and equipment and storage medium

    CN117115833A