Image processing model training method, image processing method and corresponding device
Through the super-resolution processing and down-sampling processing of the generation network, combined with the adjustment of the total image loss, the problem of low training efficiency and poor quality of the face sharpening model in the existing technology is solved, and the visual quality of the image processing model is significantly improved.
Patent Information
- Application Number
- CN202010335224.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-24
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-04-24
AI Technical Summary
The training method of the face sharpening model in the existing technology is inefficient and the model quality is poor, resulting in low visual quality of the output image.
By obtaining the sample image and the reference image, the generation network is used for super-resolution processing and down-sampling processing, the total image loss is calculated, and the generation network parameters are adjusted according to the loss to improve image processing capabilities and visual quality.
A more efficient image processing model training is achieved, and the visual quality of the output image is significantly improved, especially in terms of facial image clarity.
Smart Images

Figure CN113554047B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology. Specifically, the present application relates to a training method for an image processing model, an image processing method and a corresponding device. Background Art
[0002] Deep learning technology has made rapid progress in the past five years. Major companies have invested huge capital and manpower in deep learning technology research and continuously launched their unique products and technologies. At present, deep learning technology is mainly used to solve problems including: recommendation engine, image classification, image search, face recognition, age recognition, speech recognition, etc. Deep learning technology has made breakthrough progress in the field of human-like data perception, such as describing image content, identifying objects in complex environments in images, and speech recognition in noisy environments. At the same time, deep learning technology can also solve the problems of image generation and fusion. Compared with traditional methods, deep learning technology is like a huge filter.
[0003] Face sharpening (also known as face illusion) is an image processing technology that has emerged with the development of deep learning technology. This technology can restore a very unclear face photo to a clear photo. It has a huge application space in the fields of old photo processing and photo beautification.
[0004] A typical technique for face sharpening using deep learning is to complete the task of face sharpening through three completely independent models (decoder 1, encoder and decoder 2). During the training process, the three models are trained separately, and when training decoder 2, the corresponding parameters can only be updated based on the output of decoder 2. This training method is relatively cumbersome and inefficient, and the quality of the trained model is poor. The overall visual quality of the final output image is poor, and the image quality is not much improved compared to the original input image. Summary of the invention
[0005] In view of the shortcomings of existing methods, the present application proposes an image processing model training method, an image processing method and a corresponding device to solve the technical problems in the prior art that the model training method is inefficient and the quality of the trained model is poor.
[0006] In a first aspect, an embodiment of the present application provides a method for training an image processing model, comprising:
[0007] Acquire a sample image and a first reference image; the information volume and resolution of the sample image are respectively lower than the information volume and resolution of the first reference image;
[0008] Inputting the sample image into a generative network in the image processing model, performing super-resolution processing and down-sampling processing on the sample image through the generative network, and generating and outputting at least one result image;
[0009] determining a total image loss of at least one result image based on the first reference image;
[0010] The parameters of the generation network are adjusted according to the total image loss, so that the total image loss of at least one result image output by the adjusted generation network meets the image loss condition.
[0011] In a second aspect, an embodiment of the present application provides an image processing method, including:
[0012] Obtain the image to be processed;
[0013] The image to be processed is input into the image processing model, and a processed image is obtained based on the output of the generative network in the image processing model; the image processing model is trained by the image processing model training method provided in the first aspect of the embodiment of the present application.
[0014] In a third aspect, an embodiment of the present application provides a training device for an image processing model, comprising:
[0015] An image acquisition module, used to acquire a sample image and a first reference image; the image quality and image resolution of the sample image are respectively lower than the image quality and image resolution of the first reference image;
[0016] An image generation module, used for inputting a sample image into a generation network in an image processing model, performing super-resolution and down-sampling processing on the sample image through the generation network, and generating and outputting at least one result image;
[0017] An image loss determination module, configured to determine a total image loss of at least one result image based on the first reference image;
[0018] The generation network adjustment module is used to adjust the parameters of the generation network according to the total image loss so that the total image loss of at least one result image output by the adjusted generation network meets the image loss condition.
[0019] In a fourth aspect, an embodiment of the present application provides an image processing device, including:
[0020] An image acquisition module, used for acquiring an image to be processed;
[0021] The image processing module is used to input the image to be processed into the image processing model, and obtain the processed image based on the output of the generation network in the image processing model; the image processing model is trained by the image processing model training method provided in the first aspect of the embodiment of the present application.
[0022] In a fifth aspect, an embodiment of the present application provides an image processing device, including:
[0023] Memory;
[0024] A processor, electrically connected to the memory;
[0025] The memory stores a computer program, and the computer program is executed by the processor to implement the training method of the image processing model provided in the first aspect of the embodiment of the present application.
[0026] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the training method of the image processing model provided in the first aspect of the embodiment of the present application.
[0027] The technical solution provided in the embodiments of the present application has at least the following beneficial effects:
[0028] The embodiment of the present application can train the image processing model as a whole. Compared with the method of training each model separately in the prior art, the training method of the embodiment of the present application is simpler and more efficient. The embodiment of the present application can be trained based on at least one output of the generation network in the image processing model. Based on different outputs, the total loss of the output image can be determined more comprehensively and accurately. Based on the total image loss, the parameters of the generation network can be adjusted more accurately to improve the generation network's processing ability for the input image, such as the ability to sharpen facial images, and output images with higher visual quality.
[0029] Additional aspects and advantages of the present application will be partially given in the following description, which will become apparent from the following description, or will be understood through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0031] Figure 1 A structural diagram of a convolutional neural network;
[0032] Figure 2 This is a schematic diagram of the principle of the DEMUX layer in the embodiment of the present application;
[0033] Figure 3 This is a schematic diagram of the principle of the MUX layer in the embodiment of the present application;
[0034] Figure 4 A schematic diagram of a structure of a generated network in an embodiment of the present application;
[0035] Figure 5A schematic diagram of another structure of a generated network in an embodiment of the present application;
[0036] Figure 6 A schematic diagram of the structure of an identification network in an embodiment of the present application;
[0037] Figure 7 A flowchart of a method for training an image processing model provided in an embodiment of the present application;
[0038] Figure 8 This is a partial schematic diagram of the principles of training a generation network in an embodiment of the present application;
[0039] Fig. 9 A partial flow chart of another method for training an image processing model provided in an embodiment of the present application;
[0040] Fig.10 This is a partial schematic diagram of the principle of training the identification network in an embodiment of the present application;
[0041] Fig.11 A flowchart of an image processing method provided in an embodiment of the present application;
[0042] Fig.12 A schematic diagram of the effect of image processing using the image processing method provided in an embodiment of the present application;
[0043] Fig.13 A schematic diagram of the structural framework of a training device for an image processing model provided in an embodiment of the present application;
[0044] Fig.14 A schematic diagram of the structural framework of an image processing device provided in an embodiment of the present application;
[0045] Fig.15 A schematic diagram of the structural framework of an image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The present application is described in detail below, and examples of embodiments of the present application are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar components or components with the same or similar functions. In addition, if the detailed description of the known technology is unnecessary for the features of the present application shown, it will be omitted. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.
[0047] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.
[0048] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0049] First, some of the terms involved in this application are introduced and explained:
[0050] Convolutional Neural Networks:
[0051] Convolutional neural network is a special structure of neural network, which takes images as input and output of the system and replaces scalar weights with convolution kernels. A three-layer convolutional neural network is as follows: Figure 1 As shown in the figure, the network has 4 inputs, 3 outputs in the hidden layer, and 2 outputs in the output layer. Finally, the system outputs two images. represents a convolution kernel, k represents the input layer number, i and j represent the input and output unit numbers. It is a set of scalars superimposed on the output of the convolution layer. The convolution layer output with the superimposed bias will then enter the activation layer (usually RELU or sigmoid function). After training, the convolution kernel and bias of the system are fixed. The training is to tune the parameters of the convolution kernel and bias through a set of matching input and output and optimization algorithms. Usually, each convolution layer can contain dozens or hundreds of convolution kernels, and deep neural networks often contain more than 5 convolution layers.
[0052] DEMUX layer:
[0053] The function of the DEMUX layer is to decompose a two-dimensional matrix into four small matrices whose length and width are half of the original matrix, such as Figure 2 shown.
[0054] Applied in image processing, the DEMUX layer can scramble image pixels and decompose an image into four small images, where the length and width of the small images are both 1 / 2 of the original image. It can be used as a downsampling layer in convolutional neural networks.
[0055] MUX layer:
[0056] The function of the MUX layer is to combine two-dimensional matrices. It can combine four small matrices of the same size into a large matrix, where the length and width of the large matrix are both twice that of the small matrix. Figure 3 shown.
[0057] Applied in image processing, the MUX layer can scramble the pixels of the image and combine four small images into a large image, where the length and width of the large image are both twice those of the small images. It can be used as an upsampling layer in convolutional neural networks.
[0058] Combination Figure 2 and Figure 3 It can be seen that MUX and DEMUX are inverse operations of each other, and during the processing process, only the positions of pixels are rearranged according to certain rules, and no pixel information is lost. Therefore, MUX and DEMUX can upsample and downsample images without loss.
[0059] Loss function:
[0060] 1) Content loss:
[0061] In the analysis network, the output of each convolutional layer is the feature of the input image. l The convolution layer with convolution kernels has an output containing N l feature images, assuming that the size of each feature image is M l (width × height of feature image). The output of layer l can be stored in the matrix middle. Represents the value of the jth position in the feature image output by the i-th convolution kernel in the l-th layer.
[0062] definition and are the original input image and the generated image, respectively, l and F l are their feature images of the output of layer l in the analysis network, then the content loss is defined as follows:
[0063]
[0064] Among them, L content Represents content loss; C1 is a constant used to standardize the results.
[0065] 2) Fighting Losses:
[0066] The adversarial loss function of the discriminator network (or discriminator) is:
[0067] L_D=-E x~Pdata(x) [log D(x)]-E z~Pz(z) [1-log D(G(z))] Expression (2)
[0068] The adversarial loss function of the generative network (or generator) is:
[0069] L_G=E x~Pdata(x) [log D(x)]+F z~Pz(z) [1-log D(G(z))] Expression (3)
[0070] In expressions (2) and (3), D is the discriminant network, G is the generative network; L_D is the adversarial loss of the discriminant network output, L_G is the adversarial loss of the generative network output; z is the input of the generative network, Pz is the input set of the generative network; x is a true sample, Pdata is the true sample set, that is, the set that can make the discriminant network output 1; D(x) is the result obtained after the true sample is input to the discriminant network, G(z) is the output result of the generative network; E x~Pdata(x) Indicates that x is sampled from the true sample set, and subsequent operations are performed on any x; E z~Pz(z) It means that z is sampled from the input set Pz of the generator network and subsequent operations are performed on any z.
[0071] 3) Weighted L1 loss
[0072] If the training data set contains paired data, the weighted L1 loss can be used to constrain the output image in order to obtain better image restoration. The definition of L1 loss is as follows:
[0073] L1=0.299*(abs(R i -R g ))+0.587*(abs(G i -G g ))+0.114*(abs(B i -B g )) Expression (4)
[0074] In expression (4), R i , G i , Bi They are the R, G, and B channels of the output results, respectively. g , G g , B g They are respectively the R, G, and B channels of high-quality images in the data set (relative to the image quality in the training data set, the image quality can be characterized by the amount of information in the image, and the amount of information can be further characterized by information entropy), and abs() is an absolute value operation. During the training process, in order to obtain a better image viewing experience, the weight of the weighted L1 loss should not be set too high. In expression (4), the weights of the R, G, and B channels are set to 0.299, 0.587, and 0.114, respectively. This weight value is not used as a limitation on the weighted L1 loss in the embodiment of the present application, and can be replaced by other weight values according to actual conditions.
[0075] 4) Eye area loss
[0076] In order to improve the authenticity of the generated portrait photos, especially the authenticity and symmetry of the eye part, this application proposes a new eye area loss. Let the height of the total eye area be h and the width be w, then the eye area loss is defined as follows:
[0077] L eye =L content (O eye ,G eye )+L content (O eye [:,0:0.5w],O eye [:,0.5w:w])+L content (G eye [:,0:0.5w],G eye [:,0.5w:w]) Expression (5)
[0078] In expression (5), O eye is the total eye area of the output image, G eye is the total eye area of the high-quality (relative to the quality of the original input image) image, L content (O eye ,G eye ) is the content loss of the two. If the width value of the leftmost end of the total eye area (left and right are based on the angle of the human eye observing the image on the paper or display interface) is defined as 0, and the width value of the rightmost end is w, then O eye [:,0:0.5w] represents the left half of the total eye area of the output image, O eye [:,0.5w:w] represents the right half of the total eye area, G eye [:,0:0.5w] represents the left half of the total eye area in the high-quality image, G eye[:,0.5w:w] represents the right half of the total eye area in the high-quality image; L content (O eye [:,0:0.5w],O eye [:,0.5w:w]) represents the content loss of the left and right half areas in the total eye area of the output image, L content (G eye [:,0:0.5w],G eye [:,0.5w:w] represents the content loss of the left and right half of the total eye region in the high-quality image.
[0079] The eye region loss can enhance the closeness of the eye region of the output image to the high-quality image, while constraining its left-right symmetry to be consistent with the high-quality image.
[0080] The loss function in the embodiments of the present application can be any existing loss function such as cross entropy loss function, hinge loss function (HingeLoss), exponential loss function (Exponential Loss), Softmax loss function, etc., which can be selected according to actual needs. The loss functions listed in the embodiments of the present application are only examples and do not constitute a limitation to the present application.
[0081] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments.
[0082] An embodiment of the present application provides an image processing model, including: a generation network; the generation network can be used to perform super-resolution (i.e., super resolution) and down-sampling processing on an image input into the generation network, to generate and output at least one result image; the at least one result image may include at least one of a first result image, a second result image, and a third result image.
[0083] In an optional embodiment, if Figure 4 As shown, the generation network includes: a first supramolecular network, a downsampling sub-network and a second supramolecular network which are cascaded in sequence.
[0084] The first supramolecular network is used to input the image of the first supramolecular network (such as Figure 4 The input in the image is super-resolved to obtain a first feature image; a downsampling subnetwork is used to downsample the features of the first feature image to obtain at least one second feature image; a second super-resolution module is used to super-resolve the second feature image to generate and output a first result image (such as Figure 4 The first result image is the final result image generated by the network output.
[0085] In another optional embodiment, Figure 5 As shown, based on the first supramolecular network, the downsampling subnetwork and the second supramolecular network, the generation network also includes: a first feature extraction subnetwork cascaded after the first supramolecular network and a second feature extraction subnetwork cascaded after the downsampling subnetwork.
[0086] The first feature extraction subnetwork is used to extract features from the first feature image output by the first supramolecular network, and obtain and output a second result image (such as Figure 5 Output_tmp1 in ); The second feature extraction subnetwork is used to extract features from the second feature image output by the downsampling module, generate and output a third result image (such as Figure 5 The second result image and the third result image are both intermediate result images output by the generation network.
[0087] In another optional embodiment, based on the first supramolecular network, the downsampling subnetwork and the second supramolecular network, the generation network further includes: a first feature extraction subnetwork cascaded after the first supramolecular network, or a second feature extraction subnetwork cascaded after the downsampling subnetwork. The functions of the first feature extraction subnetwork and the second feature extraction subnetwork are as described above.
[0088] Optionally, the first supramolecular network and the second supramolecular network both include a plurality of cascaded convolution blocks (convs). The embodiment of the present application does not limit the number of convolution blocks in the first supramolecular network and the second supramolecular network.
[0089] In an optional embodiment, at least part of the convolution blocks of the first supramolecular network and the second supramolecular network are first convolution blocks, and the remaining convolution blocks are second convolution blocks; wherein the first convolution block includes at least one convolution layer cascaded in sequence, and an upsampling layer cascaded after the at least one convolution layer, and the second convolution block includes at least one convolution layer cascaded in sequence.
[0090] In one example, Figure 4 or Figure 5 The first three convs in the first supramolecular network and the first three convs in the second supramolecular network are all set as the first convolutional block, and the fourth convs in the first supramolecular network and the fourth convs in the second supramolecular network are all set as the second convolutional block.
[0091] In another example, Figure 4 or Figure 5The first two convs of the first supramolecular network and the first two convs in the second supramolecular network are set as the first convolutional block, and the last two convs of the first supramolecular network and the last two convolutional blocks in the second supramolecular network are set as the second convolutional block.
[0092] In other examples, for the first supramolecular network and the second supramolecular network, other convolution block settings may be adopted according to actual needs. The first supramolecular network and the second supramolecular network may adopt the same convolution block setting method or different convolution block settings according to actual needs.
[0093] Optionally, the upsampling layer in the first convolutional block may be a MUX layer as described above.
[0094] Optionally, the downsampling module in the embodiment of the present application includes a first downsampling branch and a second downsampling branch in parallel; the first downsampling branch may include multiple cascaded convolution blocks convs, and the embodiment of the present application does not limit the number of convolution blocks in the first downsampling branch; the second downsampling branch may include a downsampling layer.
[0095] In an optional implementation, the convolution block in the first downsampling branch may be set to a third convolution block, which includes at least one convolution layer cascaded in sequence, and a downsampling layer cascaded after the at least one convolution layer.
[0096] Optionally, the downsampling layer in the first downsampling branch and the downsampling layer in the second downsampling branch may both be the DEMUX layer described above.
[0097] Optionally, the first feature extraction subnetwork and the second feature extraction subnetwork in the embodiment of the present application both include at least one convolution block cascaded in sequence, and the embodiment of the present application does not limit the number of convolution blocks in the first feature extraction subnetwork and the second feature extraction subnetwork.
[0098] In an optional embodiment, the convolution blocks in the first feature extraction subnetwork and the second feature extraction subnetwork can both be set to second convolution blocks, and the structure of the second convolution block is as described above.
[0099] Optionally, the image processing model provided in the embodiment of the present application further includes: a discriminant network; the discriminant network is used to discriminate the image input to the discriminant network, determine whether the input image has a preset feature, and output an image label. When the discriminant network is cascaded after the generative network, it can be used to constrain the output of the generative network, specifically, receive at least one result image output by the generative network, and discriminate the at least one result image.
[0100] The image label output by the identification network is used to characterize the identification result of the identification network on the input image. The image label can be represented by "1" or "0", or by "true" or "false". "1" and "true" both indicate that the image has the preset features; "0" and "false" both indicate that the image does not have the preset features.
[0101] In an optional embodiment, the identification network in the embodiment of the present application includes multiple convolutional layers (conv), pooling layers (Pool), fully connected layers (FC) and activation layers (sigmoid), and the cascade mode of each layer is as follows: Figure 6 As shown, the convolution layer and the pooling layer are used to process the input image, and then the output scalar value is obtained through the fully connected layer and the activation layer.
[0102] Optionally, at least one identification network may be set in the embodiment of the present application, and its specific number may be the same as the number of result images output by the generation network. Each identification network receives a result image of the generation network and identifies the result image, thereby achieving identification of each result image output by the generation network.
[0103] In one example, three discriminant networks may be used to respectively receive a first result image, a second result image, and a third result image output by a generation network. During the training of the image processing model, multiple discriminant networks may be used to implement constraints on the first result image, the second result image, and the third result image output by the generation network.
[0104] The specific application of the image processing model provided in the embodiment of the present application in the image processing process and the training process will be described in detail in subsequent embodiments in combination with the image processing method and the training method of the image processing model.
[0105] The present application embodiment provides a method for training an image processing model, such as Figure 7 As shown, the training method includes:
[0106] S701, acquiring a sample image and a first reference image.
[0107] In the embodiment of the present application, the amount of information and the resolution of the sample image are respectively lower than the amount of information and the resolution of the first reference image.
[0108] In the specific examples below, the sample image with relatively low information content and resolution is called a low-quality and low-resolution image, and the first reference image with relatively high information content and resolution is called a high-quality and high-resolution image.
[0109] S702, input the sample image into the generation network in the image processing model, perform super-resolution processing and down-sampling processing on the sample image through the generation network, and generate and output at least one result image.
[0110] In an optional embodiment, when the generation network includes a first supramolecular network, a downsampling subnetwork, and a second supramolecular network cascaded in sequence, a sample image is input into the first supramolecular network, and the sample image is super-resolution processed by the first supramolecular network to obtain a first feature image; the first feature image is down-sampled by the downsampling subnetwork to obtain at least one second feature image; the second feature image is super-resolution processed by the second supramolecular network to obtain and output a first result image; the resolution of the first feature image is higher than the resolution of the sample image, the resolution of the second feature image is lower than the resolution of the first feature image, and the resolution of the first result image is higher than the resolution of the second feature image.
[0111] The cascade relationship and specific structure of the first supramolecular network, the downsampling network and the second supramolecular network are as described above and will not be repeated here.
[0112] Based on the above method, combined with Figure 4 or Figure 5 It can be seen that the embodiment of the present application can perform super-resolution processing on the input sample image through the first supramolecular network (the first super-resolution processing) to obtain a high-resolution image (i.e., the first feature image, which is called a high-resolution image relative to the sample image); down-sample the first feature image through the downsampling subnetwork to obtain a low-resolution image (i.e., the second feature image, which is called a low-resolution image relative to the first feature image); and then super-resolution the second feature image through the second supramolecular network (the second super-resolution processing) to obtain and output a high-resolution image (i.e., the first result image Output, which is called a high-resolution image relative to the sample image or the second feature image), thereby improving the resolution of the sample image.
[0113] Optionally, when the downsampling subnetwork includes a first downsampling branch and a second downsampling branch in parallel, the first feature image is downsampled by the downsampling subnetwork to obtain at least one second feature image, including: downsampling the first feature image obtained by the first supramolecular network by the first downsampling branch to obtain a second feature image; downsampling the first feature image obtained by the first supramolecular network by the second downsampling branch to obtain another second feature image; the amount of information in the second feature image obtained by the second downsampling branch is greater than the amount of information in the second feature image obtained by the first downsampling branch.
[0114] The structures of the first down-sampling branch and the second down-sampling branch are as described above and will not be described again here.
[0115] The embodiment of the present application can obtain a second feature image with relatively high information content by setting a second downsampling branch, and use the second feature image obtained by the first downsampling branch together with the second feature image as the input of the second supramolecular network. The second feature image output by the second downsampling branch can make up for the shortcoming of insufficient information content of the second feature image output by the first downsampling branch, and improve the image feature information of the image input to the second supramolecular network, so that the second supramolecular network retains as much image feature information as possible when outputting the final result, thereby increasing the information content of the final result (i.e., the first result image), improving the clarity of the processed image, and obtaining a high-quality and high-resolution image.
[0116] In another optional embodiment, Figure 5 As shown, when the generation network also includes a first feature extraction subnetwork and a second feature extraction subnetwork, the first feature extraction subnetwork is used to perform feature extraction on the first feature image to obtain and output the second result image Output_tmp1; the second feature extraction subnetwork is used to perform feature extraction on the second feature image to obtain and output the third result image Output_tmp2.
[0117] In another optional embodiment, when the generation network includes a first feature extraction subnetwork, feature extraction is performed on the first feature image through the first feature extraction subnetwork to obtain and output a second result image; when the generation network includes a second feature extraction subnetwork, feature extraction is performed on the second feature image through the second feature extraction subnetwork to obtain and output a third result image.
[0118] The cascading method and specific structure of the first feature extraction subnetwork and / or the second feature extraction subnetwork are as described above and will not be repeated here.
[0119] The two result images or any result image output by the first feature extraction subnetwork and / or the second feature extraction subnetwork can be used to calculate the total image loss of the generated network output image (the calculation method will be described in detail in subsequent embodiments), thereby realizing multi-scale constraints and improving the training precision to improve the quality of the trained image processing model.
[0120] S703: Determine a total image loss of at least one result image according to the first reference image.
[0121] In an optional embodiment, when the generation network includes a first supramolecular network, a downsampling subnetwork, and a second supramolecular network that are cascaded in sequence, a first image loss of the first result image is determined according to the first reference image as the total image loss.
[0122] In another optional embodiment, when the generation network also includes a first feature extraction subnetwork and a second feature extraction subnetwork, a second reference image is generated based on the first reference image; and based on the first reference image and the second reference image, the total image loss of the first result image, the second result image, and the third result image is determined.
[0123] Optionally, a first image loss of the first result image and a second image loss of the second result image are determined according to the first reference image, a third image loss of the third result image is determined according to the second reference image, and a total image loss is determined according to the first image loss, the second image loss and the third image loss.
[0124] In another optional embodiment, when the generation network includes a first feature extraction subnetwork, the total image loss of the first result image and the second result image is determined based on the first reference image; when the generation network includes a second feature extraction subnetwork, the second reference image is generated based on the first reference image, and the total image loss of the first result image and the third result image is determined based on the first reference image and the second reference image.
[0125] Optionally, when the generation network includes a first feature extraction subnetwork, a first image loss of the first result image and a second image loss of the second result image are determined according to the first reference image, and the total image loss is determined according to the first image loss and the second image loss; when the generation network includes a second feature extraction subnetwork, the first image loss of the first result image is determined according to the first reference image, a third image loss of the third result image is determined according to the second reference image, and the total image loss is determined according to the first image loss and the third image loss.
[0126] Optionally, generating a second parameter image based on the first parameter image includes: downsampling the first reference image to obtain a second reference image; the amount of information of the second reference image is the same as that of the first reference image, the resolution of the second reference image is lower than the resolution of the first reference image, and the size of the first reference image is the same as the size of the sample image.
[0127] Both the first reference image and the second reference image can be stored in the data set for easy subsequent retrieval.
[0128] Optionally, the total image loss includes: at least one of content loss, adversarial loss, weighted L1 loss and eye area loss. Optionally, the first image loss, the second image loss and the third image loss may all include: at least one of content loss, adversarial loss, weighted L1 loss and eye area loss.
[0129] Optionally, when the total image loss includes at least one of the weighted L1 loss and the eye area loss, determining the total image loss of at least one result image according to the first reference image includes at least one of the following loss determination methods:
[0130] Method 1: Determine the weighted L1 loss based on the pixel value difference between at least one result image and the first reference image; Method 2: Determine the eye area loss based on the content loss of the eye area in at least one result image and the eye area in the first reference image.
[0131] Optionally, determining the eye region loss according to the content loss of the eye region in the at least one result image and the eye region in the first reference image includes:
[0132] For each result image, determine the content loss of the total eye area in the result image and the total eye area of the first reference image, as well as the content loss of the first eye area and the second eye area in the result image, as the total content loss and the result image content loss, respectively; determine the content loss of the first eye area and the second eye area in the first reference image as the reference image content loss; determine the eye area loss of the result image and the first reference image based on the total content loss, the result image content loss and the reference image content loss.
[0133] In the result image and the first reference image, the total eye region includes a first eye region and a second eye region, and the first eye region and the second eye region do not overlap.
[0134] In an optional embodiment, the first eye area may be the left half area of the total eye area, and the second eye area may be the right half area of the total eye area. The division of the left half area and the right half area may refer to the relevant content of the aforementioned expression (5), that is, for the total eye area with a height of h and a width of w, the area from 0 to 0.5w calculated from left to right is taken as the left half area, and the area from 0.5w to w is taken as the right half area; it may also be calculated or divided from right to left.
[0135] In another optional embodiment, the first eye area may be the upper half of the total eye area, and the second eye area may be the lower half of the total eye area. The division of the upper half and the lower half may be as follows: for a total eye area with a height of h and a width of w, the area from 0 to 0.5h calculated from top to bottom is taken as the upper half, and the area from 0.5h to h is taken as the lower half. When this division method is used, the calculation method of the eye area loss can still use expression (5), and w in expression (5) can be changed to h. It can also be calculated and divided from bottom to top.
[0136] In other optional implementations, the first eye area and the second eye area may be divided in other ways according to actual needs. For example, the left half area and the right half area are not divided equally with 0.5w as the boundary, but are divided in a certain proportion, which will not be listed here one by one.
[0137] The left, right, top and bottom in the embodiments of the present application are based on the angles at which human eyes observe the image on the paper or the display interface.
[0138] In an optional embodiment, the eye area loss of the result image and the first reference image is determined based on the total content loss, the result image content loss and the reference image content loss, including: taking the sum of the total content loss, the result image content loss and the reference image content loss as the eye area loss of the result image and the first reference image.
[0139] Figure 8 The following shows the training principle of the generator network. Figure 8 , the method of determining the total image loss is further introduced:
[0140] Figure 8 The low quality low resolution image is the sample image, the high quality high resolution image is the first reference image, and the high quality low resolution image is the second reference image.
[0141] exist Figure 8 In the example, a low-quality and low-resolution image is input into the generative network Generator, and three output images can be obtained, namely, the first result image Output output by the second super-resolution module, the second result image Output_tmp1 output by the first feature extraction module, and the third result image Output_tmp2 output by the second feature extraction module.
[0142] For Output and Output_tmp1, according to the high-quality and high-resolution images, the first image loss Loss_out of Output and the second image loss Loss_tmp_1 of Output_tmp1 can be calculated respectively.
[0143] For Output_tmp2, after downsampling the high-quality high-resolution image through the BICUBIC method, a high-quality low-resolution image with the same size as the low-quality low-resolution image can be obtained. Based on the high-quality low-resolution image, the third image loss Loss_tmp_2 of Output_tmp2 can be calculated.
[0144] The calculated Loss_out, Loss_tmp_1 and Loss_tmp_2 may include at least one of content loss, adversarial loss, weighted L1 loss and eye area loss. The specific calculation methods of the four losses can refer to the relevant contents of the aforementioned expression (1) and expressions (3)-(5), which will not be repeated here. When expression (3) is applied to the embodiment of the present application, the first reference image can be used as the "true" sample set Pdata.
[0145] Taking the above four losses as an example, the first image loss can be obtained as follows:
[0146] loss_out=a*L content (hh,output)+b*L_G(output)+c*L1(hh,output)+d*L eye (hh eye ,output eye ) Expression (6)
[0147] The second image loss can be obtained as follows:
[0148] loss_tmp_1=a*L content (hh,output_tmp1)+b*L_G(output_tmp1)+c*L1(hh,,out_tmp1)+d*L eye (hh eye ,out_tmp1 eye ) Expression (7)
[0149] The third image loss can be obtained as follows:
[0150] loss_tmp_2=a*L content (hl,output_tmp2)+b*L_G(output_tmp2)+c*L1(hl,out_tmp2)+d*L eye (hl eye ,out_tmp2 eye ) Expression (8)
[0151] In expressions (6)-(8), hh represents a high-quality high-resolution image, hl represents a high-quality low-resolution image, and hheye Represents the eye region image in a high-quality high-resolution image, hl eye Represents the eye area image in the high-quality low-resolution image, output eye 、out_tmp1 eye 、out_tmp2 eye They represent the eye area images in the corresponding result images, and a, b, c, and d are the content losses L content , adversarial loss L_G, weighted L1 loss L1, eye area loss L eye The weight parameter of .
[0152] The total image loss LOSS can be calculated as follows:
[0153] LOSS=α*loss_out+β*loss_tmp_1+γ*loss_tmp_2 Expression (9)
[0154] In expression (9), α, β, and γ are weight parameters of loss_out, oss_tmp_1, and loss_tmp_2, respectively.
[0155] The weight parameters in the embodiments of the present application can be set according to actual needs.
[0156] S704, adjusting parameters of the generation network according to the total image loss, so that the total image loss of at least one result image output by the adjusted generation network meets the image loss condition.
[0157] The image loss condition in the embodiment of the present application can be set according to actual needs. For example, a loss threshold is set according to actual needs. If the total image loss is less than the loss threshold, it is considered that the total image loss meets the image loss condition.
[0158] Alternatively, if Fig. 9 As shown, the image processing model method provided in the embodiment of the present application further includes the following steps S901-S904:
[0159] S901, inputting a first reference image and at least one result image output by a generation network into a discrimination network in an image processing model.
[0160] Optionally, for more than two identification networks, the first reference image is input into each identification network respectively, and each result image output by the generation network is input into one identification network respectively.
[0161] S902, identifying the first reference image and at least one result image through an identification network, determining whether the first reference image and at least one result image have preset features, and outputting a reference image label and a result image label.
[0162] The reference image label represents the identification result of the first reference image, and the result image label represents the identification result of at least one result image.
[0163] Optionally, for more than two identification networks, each identification network identifies the first reference image and a result image input into the identification network to determine whether the first reference image and the input result image have preset features.
[0164] S903: Determine the adversarial loss of the result image label according to the reference image label.
[0165] Optionally, the adversarial loss of the result image label is determined according to the reference image label by the loss construction module. The principle of calculating the adversarial loss by the loss construction module can refer to the relevant content of the above expression (2), which will not be repeated here.
[0166] S904, adjusting the parameters of the identification network according to the adversarial loss, so that the adversarial loss of the result image label output by the adjusted identification network meets the adversarial loss condition.
[0167] Optionally, the parameters of the discriminator network are adjusted according to the adversarial loss by an optimizer. The optimizer may be an optimizer based on any of a variety of existing optimization algorithms, including SGD (Stochastic Gradient Descent), BGD (Batch Gradient Descent), and ADAM algorithm.
[0168] Fig.10 A training method for the discriminator network is shown, such as Fig.10 As shown in the figure, the result image output by the generator network (Generator) is input as a fake sample (Fake samples) into the corresponding discriminator network (Discriminator) to obtain the fake label (F) output by the discriminator network; the high-quality and high-resolution images in the database (Dataset) are input as true samples (True samples) into the same discriminator network to obtain the true label (T) output by the discriminator network; the true label and the false label output by the discriminator network are passed through the loss building module (Loss Build) to generate the adversarial loss Loss, and then the parameters of the discriminator network are adjusted through the optimizer (Optimization).
[0169] Based on the same inventive concept, the present application embodiment provides an image processing method, such as Fig.11 As shown, the image processing method includes:
[0170] S1101, obtaining an image to be processed.
[0171] The image to be processed may be a face image or other images, such as an object image, a landscape image, etc.
[0172] S1102, inputting the image to be processed into an image processing model, and obtaining a processed image based on the output of the generation network in the image processing model.
[0173] The image processing model in the embodiment of the present application is obtained by training through any one of the training methods of the image processing model provided in the embodiment of the present application.
[0174] Optionally, the image processing method provided in the embodiment of the present application further includes: obtaining an image label of the processed image based on the output of the identification network in the image processing model; the image label represents whether the processed image has preset features.
[0175] The trained image processing model used in the embodiment of the present application has strong image processing capabilities. Based on the image processing model, the image processing method provided in the embodiment of the present application is used to perform more refined image processing on the original image to obtain a processed image with higher visual quality.
[0176] Taking the clearing processing of a face image as an example, after the original image is cleared by the image processing method of the embodiment of the present application, the visual effect of the processed image output is as follows: Fig.12 As shown by Fig.12 It can be seen that the clarity of the image processed by the image processing method of the embodiment of the present application is greatly improved compared with the clarity of the original image. Compared with the clarity of the image processed by the prior art, the clarity of the image processed by the image processing method of the embodiment of the present application is higher. It can be seen that the image processing method of the embodiment of the present application has a better effect on the clarity processing of facial images.
[0177] Based on the same inventive concept, the present application provides a training device for an image processing model, such as Fig.13 As shown, the training device includes: an image acquisition module 1301, an image generation module 1302, an image loss determination module 1303 and a generation network adjustment module 1304.
[0178] The image acquisition module 1301 is used to acquire a sample image and a first reference image; the information volume and resolution of the sample image are respectively lower than the information volume and resolution of the first reference image.
[0179] The image generation module 1302 is used to input the sample image into the generation network in the image processing model, perform super-resolution and down-sampling processing on the sample image through the generation network, and generate and output at least one result image.
[0180] The image loss determination module 1303 is configured to determine a total image loss of at least one result image according to the first reference image.
[0181] The generation network adjustment module 1304 is used to adjust the parameters of the generation network according to the total image loss, so that the total image loss of at least one result image output by the adjusted generation network meets the image loss condition.
[0182] In an optional embodiment, the image generation module 1302 is specifically used to: input a sample image into a first supramolecular network in a generation network, and perform super-resolution processing on the sample image through the first supramolecular network to obtain a first feature image; the resolution of the first feature image is higher than the resolution of the sample image; down-sample the first feature image through a downsampling subnetwork in the generation network to obtain at least one second feature image; the resolution of the second feature image is lower than the resolution of the first feature image; super-resolution the second feature image through the second supramolecular network in the generation network to obtain and output a first result image; the resolution of the first result image is higher than the resolution of the second feature image.
[0183] Optionally, the image generation module 1302 is specifically used to: downsample the first feature image through the first downsampling branch in the downsampling subnetwork to obtain a second feature image; downsample the first feature image through the second downsampling branch in the downsampling network to obtain another second feature image; the amount of information in the second feature image obtained by the second downsampling branch is greater than the amount of information in the second feature image obtained by the first downsampling branch.
[0184] In another optional embodiment, the image generation module 1302 is specifically used to: perform feature extraction on the first feature image through the first feature extraction subnetwork in the generation network to obtain and output the second result image; perform feature extraction on the second feature image through the second feature extraction subnetwork in the generation network to obtain and output the third result image.
[0185] In another optional embodiment, the image generation module 1302 is specifically used to: perform feature extraction on the first feature image through the first feature extraction subnetwork to obtain and output the second result image; or, perform feature extraction on the second feature image through the second feature extraction subnetwork to obtain and output the third result image.
[0186] In an optional implementation, the image loss determination module 1303 is specifically configured to determine, according to the first reference image, a first image loss of the first result image as the total image loss.
[0187] In another optional implementation, the image loss determination module 1303 is specifically used to: generate a second reference image according to the first reference image; and determine the total image loss of the first result image, the second result image, and the third result image according to the first reference image and the second reference image.
[0188] In another optional embodiment, the image loss determination module 1303 is specifically used to: determine the total image loss of the first result image and the second result image based on the first reference image; or, generate the second reference image based on the first reference image, and determine the total image loss of the first result image and the third result image based on the first reference image and the second reference image.
[0189] Optionally, the image loss determination module 1303 is specifically used to execute at least one of the following loss determination methods when the total image loss includes at least one of a weighted L1 loss and an eye area loss: method one, determining the weighted L1 loss based on the pixel value difference between at least one result image and the first reference image; method two, determining the eye area loss based on the content loss of the eye area in at least one result image and the eye area in the first reference image.
[0190] Optionally, the image loss determination module 1303 is specifically used to: for each result image, determine the content loss of the total eye area in the result image and the total eye area of the first reference image, and the content loss of the first eye area and the second eye area in the result image, as the total content loss and the result image content loss, respectively; determine the content loss of the first eye area and the second eye area in the first reference image as the reference image content loss; determine the eye area loss of the result image and the first reference image based on the total content loss, the result image content loss and the reference image content loss; in the result image and the first reference image, the total eye area includes the first eye area and the second eye area, and the first eye area and the second eye area do not overlap.
[0191] Optionally, the training device of the image processing model provided by the implementation of the present application also includes: an image identification module, a label loss determination module and an identification network adjustment module.
[0192] The image identification module is used to: input a first reference image and at least one result image into an identification network in an image processing model, identify the first reference image and at least one result image through the identification network, determine whether the first reference image and at least one result image have preset features, and output a reference image label and a result image label; the reference image label represents the identification result of the first reference image, and the result image label represents the identification result of the at least one result image; the label loss determination module is used to: determine the adversarial loss of the result image label according to the reference image label; the identification network adjustment module is used to: adjust the parameters of the identification network according to the adversarial loss, so that the adversarial loss of the result image label output by the adjusted identification network meets the adversarial loss condition.
[0193] Based on the same inventive concept, an image processing device provided in an embodiment of the present application is as follows: Fig.14 As shown, the image processing device 1400 includes: an image acquisition module 1401 and an image processing module 1402 .
[0194] The image acquisition module 1401 is used to acquire the image to be processed.
[0195] The image processing module 1402 is used to input the image to be processed into the image processing model, and obtain the processed image based on the output of the generation network in the image processing model; the image processing model is trained by any one of the training methods of the image processing model provided in the embodiments of the present application. The training method can refer to the aforementioned embodiments and will not be repeated here.
[0196] Optionally, the image processing device provided in the embodiment of the present application also includes: an image identification module; the image identification module is used to: obtain an image label of the processed image based on the output of the identification network in the image processing model; the image label represents whether the processed image has preset features.
[0197] The image processing model training device 1300 provided in the embodiment of the present application can execute any image processing model training method provided in the embodiment of the present application, and the image processing device 1400 provided in the embodiment of the present application can execute any image processing method provided in the embodiment of the present application. The implementation principles are similar. The contents not shown in detail in this embodiment can be referred to the various embodiments described above and will not be repeated here.
[0198] Based on the same inventive concept, an embodiment of the present application provides an image processing device, which includes: a memory and a processor, and the memory is electrically connected to the processor.
[0199] A computer program is stored in the memory, and the computer program is executed by the processor to implement any image processing method provided in the embodiments of the present application, and / or any training method of the image processing model.
[0200] Those skilled in the art will appreciate that the image processing device provided by the embodiments of the present application can be specially designed and manufactured for the desired purpose, or can also include known devices in a general-purpose computer. These devices have computer programs stored therein, which are selectively activated or reconstructed. Such a computer program can be stored in a device (e.g., computer) readable medium or in a medium suitable for storing electronic instructions and coupled to any type of bus respectively.
[0201] In an optional embodiment, the present application provides an image processing device, such as Fig.15 As shown, the image processing device 1500 includes: a memory 1501 and a processor 1502 , and the memory 1501 and the processor 1502 are electrically connected, such as connected via a bus 1503 .
[0202] The memory 1501 may be a ROM (Read-Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read-Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0203] Processor 1502 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 802 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0204] The bus 1503 may include a path to transmit information between the above components. The bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.15 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0205] Optionally, the image processing device 1500 may further include a transceiver 1504. The transceiver 1504 may be used for receiving and sending signals. The transceiver 1504 may allow the image processing device 1500 to communicate with other devices wirelessly or by wire to exchange data. It should be noted that in actual applications, the transceiver 1504 is not limited to one.
[0206] Optionally, the image processing device 1500 may further include an input unit 1505. The input unit 1505 may be used to receive input numbers, characters, images and / or sound information, or generate key signal input related to user settings and function control of the electronic device 1500. The input unit 1505 may include, but is not limited to, one or more of a touch screen, a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, a camera, a microphone, etc.
[0207] Optionally, the image processing device 1500 may further include an output unit 1506. The output unit 1506 may be used to output or display information processed by the processor 1502. The output unit 1506 may include but is not limited to one or more of a display device, a speaker, a vibration device, and the like.
[0208] Although Fig.15 The image processing apparatus 1500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0209] Optionally, the memory 1501 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 1502. The processor 1502 is used to execute the application code stored in the memory 1501 to implement any training method of the image processing model provided in the embodiment of the present application.
[0210] The image processing device provided in the embodiment of the present application has the same inventive concept as the embodiments described above. The contents not shown in detail in the image processing device can be referred to the embodiments described above and will not be repeated here.
[0211] Based on the same inventive concept, 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, it implements any image processing method provided in the embodiment of the present application, and / or any training method of the image processing model.
[0212] The computer readable medium includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM, RAM, EPROM (Erasable Programmable Read-Only Memory), EEPROM, flash memory, magnetic card or optical card. In other words, the readable medium includes any medium that can store or transmit information in a readable form by a device (e.g., a computer).
[0213] The embodiments of the present application provide a computer-readable storage medium suitable for various optional implementations of the above-mentioned image processing method and / or image processing model training method, which will not be described in detail here.
[0214] The computer-readable storage medium provided in the embodiment of the present application has the same inventive concept as the embodiments described above. The contents not shown in detail in the computer-readable storage medium can be referred to the embodiments described above and will not be repeated here.
[0215] By applying the embodiments of the present application, at least the following beneficial effects can be achieved:
[0216] 1) The embodiment of the present application can train the image processing model as a whole. Compared with the method of training each model separately in the prior art, the training method of the embodiment of the present application is simpler and more efficient; the embodiment of the present application can be trained based on at least one output of the generation network in the image processing model. Based on different outputs, the total loss of the output image can be determined more comprehensively and accurately. Based on the total image loss, the parameters of the generation network can be adjusted more accurately to improve the generation network's processing ability for the input image, such as the ability to sharpen facial images, and output images with higher visual quality.
[0217] 2) In the embodiment of the present application, the image loss of multiple outputs of the generative network can be calculated separately during the training process, and then the total image loss can be determined based on the image loss of each output, thereby realizing multi-scale constraints based on multiple outputs. The multi-scale constraints can fully utilize the original input image and the image information in the processing process, thereby improving the training quality of the generative network, making the trained generative network have stronger image processing capabilities, and greatly improving the visual quality of the image output by the generative network.
[0218] 3) In the embodiment of the present application, the downsampling subnetwork of the generation network may include two downsampling branches. After performing different downsampling processes on the first feature image output by the first supramolecular network, two second feature images with different amounts of information can be obtained. The two second feature images can complement each other. Compared with a single input method, the feature image input into the second supramolecular network retains more information, thereby making the output image of the second supramolecular network have a higher resolution and more information, and the visual quality of the output image is better.
[0219] 4) The second downsampling branch in the embodiment of the present application can realize cross-layer linking, that is, directly linking the output of the first supramolecular network with the input of the second supramolecular network to realize lossless propagation of feature information; specifically, the second downsampling branch uses a downsampling layer (such as a DEMUX layer) to perform lossless downsampling processing on the first feature image, and the processed image is directly input into the second supramolecular network without other processing. Compared with the multi-layer convolution and downsampling in the first downsampling branch, the second downsampling branch can reduce the information loss of the image to a greater extent to better compensate for the deficiency of the output image of the first downsampling branch, so that the image input into the second supramolecular network retains more information.
[0220] It will be appreciated by those skilled in the art that the various operations, methods, steps, measures, and schemes in the processes discussed in this application may be alternated, altered, combined, or deleted. Furthermore, other steps, measures, and schemes in the various operations, methods, and processes discussed in this application may also be alternated, altered, rearranged, decomposed, combined, or deleted. Furthermore, the steps, measures, and schemes in the prior art that are similar to those disclosed in this application may also be alternated, altered, rearranged, decomposed, combined, or deleted.
[0221] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0222] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0223] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A training method for an image processing model, It is characterized in that include: Acquire a sample image and a first reference image; The information volume and resolution of the sample image are respectively lower than the information volume and resolution of the first reference image; Inputting the sample image into a generation network in an image processing model, performing super-resolution processing and down-sampling processing on the sample image through the generation network, and generating and outputting at least one result image; determining a total image loss of at least one of the result images based on the first reference image; Adjusting the parameters of the generation network according to the total image loss so that the total image loss of at least one result image output by the adjusted generation network satisfies an image loss condition; The generation network includes a first supramolecular network, a downsampling subnetwork, and a second supramolecular network which are cascaded in sequence; And, inputting the sample image into the generative network of the image processing model, performing super-resolution processing and down-sampling processing on the sample image through the generative network, and generating and outputting at least one result image, including: Inputting the sample image into the first supramolecular network, and performing super-resolution processing on the sample image through the first supramolecular network to obtain a first feature image; the resolution of the first feature image is higher than the resolution of the sample image; Downsampling the first feature image through the downsampling subnetwork to obtain at least one second feature image; the resolution of the second feature image is lower than the resolution of the first feature image; Performing super-resolution processing on the second characteristic image through the second supramolecular network to obtain and output a first result image; the resolution of the first result image is higher than the resolution of the second characteristic image; The downsampling subnetwork includes a first downsampling branch and a second downsampling branch in parallel; And, performing downsampling processing on the first feature image through the downsampling subnetwork to obtain at least one second feature image includes: Downsampling the first feature image through the first downsampling branch to obtain a second feature image; The first feature image is downsampled by the second downsampling branch to obtain another second feature image; the amount of information of the second feature image obtained by the second downsampling branch is greater than the amount of information of the second feature image obtained by the first downsampling branch.
2. The training method according to claim 1, It is characterized in that The generation network further includes: a first feature extraction subnetwork cascaded after the first supramolecular network and a second feature extraction subnetwork cascaded after the downsampling subnetwork; And, the step of inputting the sample image into a generation network in the image processing model, performing super-resolution processing and down-sampling processing on the sample image through the generation network, and generating and outputting at least one result image, further comprises: Performing feature extraction on the first feature image through the first feature extraction subnetwork to obtain and output a second result image; Performing feature extraction on the second feature image through the second feature extraction subnetwork to obtain and output a third result image; And, determining the total image loss of the at least one result image according to the first reference image further includes: generating a second reference image according to the first reference image; A total image loss of the first result image, the second result image, and the third result image is determined according to the first reference image and the second reference image.
3. The training method according to claim 1, It is characterized in that The generation network further includes: a first feature extraction sub-network cascaded after the first supramolecular network, or a second feature extraction sub-network cascaded after the downsampling sub-network; And, the step of inputting the sample image into the generative network of the image processing model, performing super-resolution processing and down-sampling processing on the sample image through the generative network, and generating and outputting at least one result image, further includes: Performing feature extraction on the first feature image through the first feature extraction subnetwork to obtain and output a second result image; or performing feature extraction on the second feature image through the second feature extraction subnetwork to obtain and output a third result image; And, determining the total image loss of the at least one result image according to the first reference image comprises: determining a total image loss of the first result image and the second result image according to the first reference image; Or, a second reference image is generated according to the first reference image, and a total image loss of the first result image and the third result image is determined according to the first reference image and the second reference image.
4. The training method according to claim 1, It is characterized in that The total image loss includes at least one of content loss, adversarial loss, weighted L1 loss and eye area loss; Furthermore, when the total image loss includes at least one of the weighted L1 loss and the eye area loss, determining the total image loss of at least one result image according to the first reference image includes at least one of the following loss determination methods: Determining the weighted L1 loss according to a pixel value difference between at least one of the result images and the first reference image; The eye region loss is determined according to a content loss of the eye region in at least one of the result images and the eye region in the first reference image.
5. The training method according to claim 4, It is characterized in that The determining the eye area loss according to the content loss of the eye area in at least one of the result images and the eye area in the first reference image comprises: For each of the result images, respectively determining content losses of the total eye area in the result image and the total eye area in the first reference image, and content losses of the first eye area and the second eye area in the result image as the total content loss and the result image content loss, respectively; determining content losses of a first eye region and a second eye region in the first reference image as reference image content losses; in the result image and the first reference image, the total eye region includes the first eye region and the second eye region, and the first eye region and the second eye region do not overlap; The eye region losses of the result image and the first reference image are determined according to the total content loss, the result image content loss and the reference image content loss.
6. The training method according to claim 1, It is characterized in that Also includes: inputting the first reference image and at least one of the result images into a discriminative network in the image processing model; The first reference image and at least one of the result images are identified by the identification network to determine whether the first reference image and at least one of the result images have preset features, and a reference image label and a result image label are output; the reference image label represents the identification result of the first reference image, and the result image label represents the identification result of at least one of the result images; Determining an adversarial loss of the result image label according to the reference image label; The parameters of the identification network are adjusted according to the adversarial loss, so that the adversarial loss of the result image label output by the adjusted identification network meets the adversarial loss condition.
7. An image processing method, It is characterized in that include: Obtain the image to be processed; Inputting the image to be processed into an image processing model, and obtaining a processed image based on an output of a generation network in the image processing model; The image processing model is trained by the image processing model training method described in any one of claims 1-6.
8. A training device for an image processing model, It is characterized in that An image acquisition module, used to acquire a sample image and a first reference image; the image quality and image resolution of the sample image are respectively lower than the image quality and image resolution of the first reference image; An image generation module, used for inputting the sample image into a generation network in an image processing model, performing super-resolution and down-sampling processing on the sample image through the generation network, and generating and outputting at least one result image; an image loss determination module, configured to determine a total image loss of at least one of the result images according to the first reference image; A generating network adjustment module, used for adjusting the parameters of the generating network according to the total image loss, so that the total image loss of at least one of the result images output by the generating network after the adjustment satisfies the image loss condition; The generation network includes a first supramolecular network, a downsampling subnetwork, and a second supramolecular network which are cascaded in sequence; And, the image generation module is specifically used for: Inputting the sample image into the first supramolecular network, and performing super-resolution processing on the sample image through the first supramolecular network to obtain a first feature image; the resolution of the first feature image is higher than the resolution of the sample image; Downsampling the first feature image through the downsampling subnetwork to obtain at least one second feature image; the resolution of the second feature image is lower than the resolution of the first feature image; Performing super-resolution processing on the second characteristic image through the second supramolecular network to obtain and output a first result image; the resolution of the first result image is higher than the resolution of the second characteristic image; The downsampling subnetwork includes a first downsampling branch and a second downsampling branch in parallel; And, the image generation module is specifically used for: Downsampling the first feature image through the first downsampling branch to obtain a second feature image; The first feature image is downsampled by the second downsampling branch to obtain another second feature image; the amount of information of the second feature image obtained by the second downsampling branch is greater than the amount of information of the second feature image obtained by the first downsampling branch.
9. An image processing device, It is characterized in that include: An image acquisition module, used for acquiring an image to be processed; An image processing module, used for inputting the image to be processed into an image processing model, and obtaining a processed image based on the output of the generation network in the image processing model; The image processing model is trained by the image processing model training method described in any one of claims 1-6.
10. An image processing device, It is characterized in that include: Memory; A processor, electrically connected to the memory; The memory stores a computer program, and the computer program is executed by the processor to implement: the training method of the image processing model described in any one of claims 1-6, and / or the image processing method described in claim 7.
11. A computer-readable storage medium, It is characterized in that A computer program is stored, and when the computer program is executed by a processor, it implements: the training method of the image processing model described in any one of claims 1 to 6, and / or the image processing method described in claim 7.
