Image processing method and device
By using multi-modal convolution kernels in the neural network model to process images, the problem of insufficient recovery capabilities of traditional methods from various degradation factors is solved, and the quality of the images is significantly improved, especially when processing images captured by mobile phone cameras.
Patent Information
- Application Number
- CN202010869230.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-26
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-08-26
AI Technical Summary
Traditional image restoration methods have poor ability to restore distorted images that contain multiple quality degradation factors, especially low image quality caused by motion blur, tensor noise and compression artifacts that are common in images captured by mobile phone cameras.
Using a pre-trained neural network model, multi-modal convolution kernels calculated based on the target preset weights and weight coefficients of respective degradation factors are used to extract the characteristics of the degradation factors, and the operation results of the convolution layer are adjusted to improve Restore intensity and improve image quality.
It significantly improves the ability to restore distorted images against various degradation factors, improves image quality, and can effectively handle images containing motion blur, noise and artifacts.
Smart Images

Figure CN114119377B
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of image processing, and in particular, relates to an image processing method, apparatus, terminal device, and computer-readable storage medium. Background Art
[0002] Image restoration refers to the process of restoring the original content or quality of a degraded or distorted image. Distorted images often contain several types of degradation, such as noise, blur, and artifacts that coexist and affect each other. Taking the images taken by mobile phone cameras as an example, they often contain several degradation factors such as motion blur, tensor noise, and compression artifacts (degradation factors refer to factors that reduce image quality), resulting in low image quality.
[0003] However, traditional image restoration methods have poor restoration capabilities for distorted images that contain several degradation factors. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an image processing method, apparatus, terminal device and computer-readable storage medium, which can solve the technical problem that traditional image restoration methods have poor restoration capabilities for distorted images containing several degradation factors.
[0005] A first aspect of an embodiment of the present application provides an image processing method, the method comprising:
[0006] Acquire an image to be processed, wherein the image to be processed includes an image having a plurality of degradation factors;
[0007] Inputting the image to be processed into a pre-trained neural network model, and processing the image to be processed by the pre-trained neural network model to obtain a target image output by the pre-trained neural network model;
[0008] Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
[0009] A second aspect of an embodiment of the present application provides an image processing device, the system comprising:
[0010] A first acquisition unit, used to acquire an image to be processed, wherein the image to be processed includes an image with a plurality of degradation factors;
[0011] A processing unit, used for inputting the image to be processed into a pre-trained neural network model, and processing the image to be processed by the pre-trained neural network model to obtain a target image output by the pre-trained neural network model;
[0012] Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
[0013] A third aspect of an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.
[0014] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0015] Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows: in the present application, by acquiring an image to be processed, the image to be processed includes an image with several degradation factors. The image to be processed is input into a pre-trained neural network model, and the pre-trained neural network model processes the image to be processed to obtain a target image output by the pre-trained neural network model. Among them, the pre-trained neural network model contains a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the several degradation factors, and the multimodal convolution kernel is used to extract the features of several degradation factors. The present application obtains a multimodal convolution kernel based on the target preset weights and target weight coefficients. Then, the calculation result of the target convolution layer is adjusted to improve the restoration strength between different degradation factors, thereby improving the ability to restore distorted images for several degradation factors. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or related technical descriptions 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.
[0017] Figure 1 A schematic flow chart of an image processing method provided by the present application is shown;
[0018] Figure 2 A schematic diagram of a traditional EDSR network architecture in an image processing method provided by the present application is shown;
[0019] Figure 3A schematic diagram of an improved EDSR network architecture in an image processing method provided by the present application is shown;
[0020] Figure 4 A specific schematic flow chart of step 102 in an image processing method provided by the present application is shown;
[0021] Figure 5 An image processing method provided by the present application is shown Figure 3 Schematic diagram of the corresponding residual module structure;
[0022] Figure 6 A schematic flow chart of another image processing method provided by the present application is shown;
[0023] Figure 7 A specific schematic flow chart of step 603 in an image processing method provided by the present application is shown;
[0024] Figure 8 A specific schematic flow chart of step 6031 in an image processing method provided by the present application is shown;
[0025] Fig. 9 A schematic diagram of an image processing device provided by the present application is shown;
[0026] Fig.10 A schematic diagram of a terminal device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0029] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0030] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0031] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0032] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0033] Image restoration refers to the process of restoring the original content or quality of a degraded or distorted image. In this embodiment, the image restoration includes but is not limited to image processing technologies such as super-resolution technology, image denoising technology, and image blurring technology.
[0034] Distorted images often contain several types of degradation, such as noise, blur, and artifacts coexisting and affecting each other. Take the images taken by mobile phone cameras as an example, they often contain several degradation factors such as motion blur, tensor noise, and compression artifacts, resulting in low image quality.
[0035] However, traditional image restoration methods have poor ability to restore distorted images caused by several degradation factors.
[0036] In view of this, the embodiments of the present application provide an image processing method, apparatus, terminal device and computer-readable storage medium, which can solve the technical problem that traditional image restoration methods have poor restoration capabilities for distorted images with several degradation factors.
[0037] See also Figure 1 , Figure 1 A schematic flowchart of an image processing method provided by the present application is shown.
[0038] like Figure 1 As shown, the method may include the following steps:
[0039] Step 101: Acquire an image to be processed, wherein the image to be processed includes an image with several degradation factors.
[0040] The degradation factors refer to factors that reduce the image quality, including factors such as motion blur, tensor noise, and compression artifacts. The image to be processed contains several degradation factors. Since different degradation factors jointly affect the image quality of the image to be processed, this embodiment uses a neural network model with a multi-modal convolution kernel to repair the image to be processed.
[0041] Step 102, input the image to be processed into a pre-trained neural network model, and the pre-trained neural network model processes the image to be processed to obtain a target image output by the pre-trained neural network model. The pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to the plurality of degradation factors, and the multimodal convolution kernel is used to extract features of the plurality of degradation factors.
[0042] In order to enable the model to have the feature extraction capabilities corresponding to several degradation factors, this application calculates the multimodal convolution kernel of the target convolution layer according to the target preset weights and target weight coefficients corresponding to each of the several degradation factors.
[0043] The convolution kernel is used to perform weighted averaging of pixels in a small area of the processed image to obtain each corresponding pixel in the output image. The weights are defined by a function called a convolution kernel. The multimodal convolution kernel in this application is derived from the target preset weights and target weight coefficients corresponding to multiple degradation factors, that is, the final weights are obtained by merging the target preset weights and target weight coefficients. The final weights are used as the multimodal convolution kernel.
[0044] The process of calculating the multimodal convolution kernel is as follows: multiply the target preset weight and the target weight coefficient corresponding to each degradation factor respectively to obtain multiple products. Add the multiple products to obtain the final weight. Generate the multimodal convolution kernel according to the final weight and the preset convolution kernel size.
[0045] The multimodal convolution kernel is used to extract the features of several degradation factors, and then perform feature enhancement and feature reconstruction according to the features of several degradation factors to obtain the target image. The ability to restore several degradation factors is achieved.
[0046] The network architecture of the neural network model includes but is not limited to super-resolution convolutional neural network (Learning a Deep Convolutional Network for Image Super-Resolution, SRCNN), accelerating super-resolution convolutional neural network (Accelerating the Super-Resolution Convolutional Neural Network, FSRCNN) network architecture, real-time super-resolution pixel convolutional neural network (Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural, ESPCN) network architecture and single image super-resolution enhanced deep residual network (Enhanced Deep Residual Networks for Single Image Super-Resolution, EDSR) network architecture and other network architectures used for image processing.
[0047] Among them, since the network layers of the neural network models used in the field of image processing are often deep, as the network depth increases, it is easy to cause gradient diffusion or gradient explosion. The residual network can solve the problem of gradient diffusion or gradient explosion very well. The residual network is composed of a series of residual blocks, which can make up for the problem of gradient diffusion or gradient explosion caused by a deeper network. Therefore, this embodiment selects the EDSR network architecture as the basic architecture of this embodiment, and explains it on this architecture. EDSR includes multiple residual layers (residual layers are used for feature enhancement). The biggest difference between EDSR and other network architectures is that there is no batch normalization calculation in EDSR, so that EDSR can stack more residual layers to improve the image processing effect. The EDSR architecture is described in detail below. It should be emphasized that this application can also adapt to other neural network models, and it only serves as an example for the EDSR network architecture, not a limitation. Please refer to Figure 2 , Figure 2 FIG. 1 is a schematic diagram showing a traditional EDSR network architecture in an image processing method provided by the present application. Figure 2 As shown in FIG, the EDSR network architecture includes a feature extraction module, a feature enhancement module (which is often composed of a global residual connection and a stacked residual module), and a reconstruction module.
[0048] Since the EDSR network architecture includes multiple convolutional layers, the multimodal convolution kernel described in this embodiment can be applied to any one or more target convolutional layers in the feature extraction module and / or feature enhancement module. The number of convolutional layers and their positions in the network architecture can be determined according to the actual application scenario or experimental data, and no limitation is made here. In order to better illustrate the technical solution of this embodiment, this embodiment uses the convolutional layer in the residual module as an example for explanation. Among them, the multimodal convolution kernel is calculated by the target preset weights and target weight coefficients corresponding to several degradation factors.
[0049] It is understandable that different target preset weights have different feature extraction capabilities for different degradation factors. However, this embodiment integrates the target preset weights corresponding to several degradation factors, so that the target convolution layer has better feature extraction capabilities for the image to be processed.
[0050] See also Figure 3 , Figure 3 FIG. 1 shows a schematic diagram of an improved EDSR network architecture in an image processing method provided by the present application. Figure 3 As shown, the improved EDSR network architecture still includes a feature extraction module (i.e., Conv1), a feature enhancement module (i.e., ResBlock1 and ResBlock2), and a reconstruction module (i.e., Conv2). Different from the traditional EDSR network architecture, the improved EDSR network architecture adds a restoration strength adjustment branch Conditional in the residual module. The user inputs the first weight coefficient corresponding to different degradation factors in the restoration strength adjustment branch Conditional to obtain Alpha composed of multiple first weight coefficients, that is, Alpha is a set of first weight coefficients for different degradation factors input by the user, which is used to adjust the first preset weights corresponding to different degradation factors. For example, the proportions corresponding to the three degradation factors in the sample image are: the noise intensity is 40% of the maximum noise, the artifact is 80% of the most serious artifact, and the blur degree is 60% of the most blurred Chengdu. At this time, the user can input Alpha as a preset weight coefficient of [0.4, 0.8, 0.6] to adjust the restoration strength corresponding to different degradation factors. As shown Figure 3 As shown, in this implementation, the target convolution layers in the residual module ResBlock 1 and the residual module ResBlock 2 are assigned the same Alpha to adjust the restoration strength corresponding to different degradation factors. In actual application scenarios, the target convolution layers assigned Alpha can be more or less. It should be emphasized that Figure 3 This is just an example, and there is no limitation on the number and position of residual modules assigned with Alpha.
[0051] Specifically, step 1021 includes the following steps: Figure 4 , Figure 4 A specific schematic flow chart of step 102 in an image processing method provided by the present application is shown.
[0052] Step 1021, the image to be processed is processed layer by layer by the preceding network layer of the target convolution layer to obtain the input of the target convolution layer.
[0053] The target convolution layer is a convolution layer with target preset weights. Figure 5 , Figure 5 An image processing method provided by the present application is shown Figure 3 The corresponding residual module structure diagram. Figure 5 As shown in FIG. 1 , weight 1, weight 2, and weight 3 represent target preset weights, and weight 4 represents the multimodal convolution kernel. Alpha represents the target weight coefficient, and Conv4 represents the target convolution layer. The front network layer of the target convolution layer includes Figure 3 The image to be processed is processed by the convolutional layers Conv1 and Conv3 to obtain the input of the target convolutional layer.
[0054] Step 1022: multiply the target preset weight and the target weight coefficient corresponding to each degradation factor to obtain a plurality of products.
[0055] Step 1023: Add multiple products to obtain a multimodal weight, and use the multimodal weight as the multimodal convolution kernel of the target convolution layer.
[0056] The target weight coefficient Alpha is multiplied by the corresponding weight 1, weight 2, and weight 3 to obtain multiple products. Then, the multiple products are added together to obtain weight 4, i.e., the multimodal convolution kernel.
[0057] It should be emphasized that Figure 3 Alpha and Figure 5 The Alpha in is the same data. Figure 5 yes Figure 3 The specific calculation process of Alpha.
[0058] The calculation process of step 1023 is as follows:
[0059]
[0060] Where A represents the multimodal convolution kernel, K represents the number of degradation factors, k represents the kth degradation factor, and Wk represents the preset weight of the kth target, α k represents the kth target weight coefficient. Among them, α k The constraint condition is: 0 <= α k <=1.
[0061] Step 1024, performing convolution calculation on the input of the target convolution layer through the multimodal convolution kernel in the target convolution layer to obtain the input of the post-network layer, and obtaining the target image through layer-by-layer processing of the post-network layer.
[0062] The input of the target convolution layer Conv4 is convolved by the multimodal convolution kernel to obtain the input of the post-network layer, and is processed layer by layer by the post-network layer to obtain the target image. For example, the input of the target convolution layer Conv4 is convolved by the multimodal convolution kernel to obtain the input of ResBlock2. The output result of ResBlock2 is connected through the global residual connection to obtain the input of the convolution layer Conv2. After being processed by the convolution layer Conv2, the target image is obtained.
[0063] It can be understood that, in this embodiment, an image to be processed is obtained, and the image to be processed includes an image with several degradation factors. The image to be processed is input into a pre-trained neural network model, and the pre-trained neural network model processes the image to be processed to obtain a target image output by the pre-trained neural network model. Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract the features of several degradation factors. The present application obtains a multimodal convolution kernel based on the target preset weights and target weight coefficients. Then, the calculation result of the target convolution layer is adjusted to improve the restoration strength between different degradation factors, thereby improving the ability to restore distorted images for several degradation factors.
[0064] Optionally, in the above Figure 1 Based on the embodiment shown, before obtaining the image to be processed, the following steps are also included. Figure 6 , Figure 6 FIG. 6 is a schematic flow chart of another image processing method provided by the present application. In this embodiment, steps 604 to 605 are similar to Figure 1 In the embodiment shown, steps 101 to 102 are the same, for details, please refer to Figure 1 The relevant descriptions of step 101 to step 102 in the illustrated embodiment are not repeated here.
[0065] Step 601: Obtain first weight coefficients corresponding to each of the plurality of degradation factors input by the user.
[0066] According to experimental data, if the first weight coefficient input by the user is directly used to perform weighted calculation on the target preset weight, the image restoration effect obtained is poor. Therefore, this embodiment trains the first weight coefficient input by the user to obtain the target weight coefficient, so as to adjust the target preset weights of several degradation factors through the optimal weight coefficient.
[0067] Step 602: Acquire a sample image pair, wherein the sample image pair includes an original image and the original image after restoration processing.
[0068] This embodiment obtains an original image from an existing database, wherein the original image has several degradation factors. The original image is processed by image restoration technology to obtain a restored original image. The original image and the restored original image are used as sample image pairs to train the neural network model to be trained.
[0069] Step 603: Train the neural network model to be trained according to the sample image pair to adjust the first preset weights and the first weight coefficients corresponding to each of the degradation factors to obtain the pre-trained neural network model, wherein the pre-trained neural network model includes the target preset weights corresponding to the first preset weights and the target weight coefficients corresponding to the first weight coefficients.
[0070] The first preset weight refers to an initialization value of the preset weight. In this embodiment, the first preset weight in the neural network model to be trained is trained to obtain target preset weights corresponding to the degradation factors.
[0071] The first preset weight and the first weight coefficient may be trained separately or together.
[0072] Specifically, the training of the first preset weights and the first weight coefficients corresponding to the plurality of degradation factors respectively according to the sample image pair to obtain the pre-trained neural network model includes the following steps, see Figure 7 , Figure 7 A specific schematic flow chart of step 603 in an image processing method provided by the present application is shown.
[0073] Step 6031: train the neural network model to be trained according to the sample image pairs to adjust the multiple first preset weights corresponding to the degradation factors to obtain a first neural network model.
[0074] Specifically, step 6031 includes the following steps, see Figure 8 , Figure 8A specific schematic flow chart of step 6031 in an image processing method provided by the present application is shown.
[0075] Step 6031a: Use one of the first preset weights among the plurality of first preset weights as a training object.
[0076] Step 6031b: setting other first preset weights other than the first preset weight corresponding to the training object among the multiple first preset weights to preset values.
[0077] The preset value can be any value.
[0078] Step 6031c: train the training object in the neural network model to be trained according to the sample image pair.
[0079] Step 6031d, repeatedly executing the step of taking one of the first preset weights as a training object and subsequent steps until the training of the first preset weights is completed to obtain the first neural network.
[0080] Repeat steps 6031a to 6031d to train each first preset weight and obtain a target preset weight corresponding to each first preset weight, thereby obtaining a first neural network.
[0081] The training process of each first preset weight is as follows: the original image in the sample image pair is input into the neural network model to be trained, and the original image is restored by the neural network model to be trained to obtain a predicted image output by the neural network model to be trained. The error between the predicted image and the restored original image is calculated (for example, the error between the predicted image and the restored original image is calculated according to the loss function). When the error is less than or equal to the threshold, the training is stopped and the second preset weight is obtained. When the training of multiple first preset weights is completed, the first neural network is obtained.
[0082] Step 6032: train the first neural network model according to the sample image pair to adjust the first weight coefficient and the second preset weight in the first neural network model to obtain the pre-trained neural network model, wherein the second preset weight is the weight obtained after training the first preset weight.
[0083] After obtaining the trained multiple first preset weights, this embodiment simultaneously trains the first weight coefficients and the second preset weights to obtain the pre-trained neural network model.
[0084] Preferably, this embodiment adopts an end-to-end training method to jointly train the first weight coefficient and the trained multiple first preset weights.
[0085] Exemplarily, three degradation factors are taken as examples: compression degradation factor, denoising degradation factor and deblurring degradation factor. Assume that the proportions of the three degradation factors in the image to be processed are: "the noise caused by the denoising degradation factor is 40% of the maximum noise, the degree of artifacts caused by the compression degradation factor is 80% of the most serious artifacts, and the degree of blur caused by the blur degradation factor is 60% of the most blurred Chengdu". Assume that the user enters the first weight coefficient Alpha [0.4, 0.8, 0.6] corresponding to different degradation factors in the restoration strength adjustment branch Conditional. The training process is as follows: In the first training, the first preset weight of the compression degradation factor is used as the training object, and the first preset weight of the denoising degradation factor and the first preset weight of the deblurring degradation factor are set to 0. According to the sample image pair, the first preset weight of the compression degradation factor is trained to obtain the second preset weight of the compression degradation factor. In the second training, the first preset weight of the denoising degradation factor is used as the training object, and the first preset weight of the compression degradation factor and the first preset weight of the deblurring degradation factor are set to 0. According to the sample image pair, the first preset weight of the denoising degradation factor is trained to obtain the second preset weight of the denoising degradation factor. In the third training, the first preset weight of the deblurring degradation factor is used as the training object, and the first preset weight of the compression degradation factor and the first preset weight of the denoising degradation factor are set to 0. According to the sample image pair, the first preset weight of the deblurring degradation factor is trained to obtain the second preset weight of the blur degradation factor. At this time, all the first preset weights are trained to obtain the first neural network. Then, the first weight coefficient and the second preset weight in the first neural network model are trained in an end-to-end manner. The end-to-end training process is as follows: the original image in the sample image pair is input into the first neural network model, and the first neural network model processes the original image to obtain the predicted image output by the first neural network model. The error between the predicted image and the original image after restoration processing is calculated (for example: the error between the predicted image and the original image after restoration processing is calculated according to the loss function). When the error is less than or equal to the threshold, the training is stopped to obtain the pre-trained neural network model. When the error is greater than the threshold, back propagation is performed on each network layer in the first neural network model, so that each network layer adjusts the first weight coefficient and the second preset weight according to the error. Until the error between the predicted image and the original image after restoration is less than or equal to the threshold, a pre-trained neural network model is obtained. It should be emphasized that the above example is only an example, and there is no limitation on the number and value of the preset weights and weight coefficients.
[0086] Step 604: Acquire an image to be processed, where the image to be processed includes an image with several degradation factors.
[0087] Step 605: input the image to be processed into a pre-trained neural network model, and the pre-trained neural network model processes the image to be processed to obtain a target image output by the pre-trained neural network model; wherein the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
[0088] In this embodiment, the first weight coefficients corresponding to each of the degradation factors input by the user are obtained. A sample image pair is obtained, and the sample image pair includes an original image and an original image after restoration processing. According to the sample image pair, the first preset weights and first weight coefficients corresponding to each of the degradation factors in the neural network model to be trained are trained to obtain the pre-trained neural network model. The present application obtains a pre-trained neural network model by training the first preset weights and the first weight coefficients in the neural network model to be trained. The pre-trained neural network model includes a multimodal convolution kernel obtained according to the target preset weights and target weight coefficients corresponding to each of the degradation factors. In order to improve the restoration strength between different degradation factors, the distorted image restoration capability for several degradation factors is improved.
[0089] like Fig. 9 This application provides an image processing device 9, see Fig. 9 , Fig. 9 A schematic diagram of an image processing device provided by the present application is shown in FIG. Fig. 9 An image processing device is shown, comprising:
[0090] A first acquisition unit 91 is used to acquire an image to be processed, wherein the image to be processed includes an image with several degradation factors;
[0091] A processing unit 92 is used to input the image to be processed into a pre-trained neural network model, and the pre-trained neural network model processes the image to be processed to obtain a target image output by the pre-trained neural network model;
[0092] Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
[0093] The neural network model includes a plurality of modules consisting of convolutional layers and activation functions, wherein the modules include a feature extraction module, a feature enhancement module and a reconstruction module, wherein the feature extraction module and / or the feature enhancement module includes a target convolutional layer;
[0094] The processing unit is specifically used to process the image to be processed layer by layer through the preceding network layer of the target convolution layer to obtain the input of the target convolution layer; multiply the target preset weight corresponding to each degradation factor and the target weight coefficient to obtain a plurality of products; add the plurality of products to obtain a multimodal weight, and use the multimodal weight as the multimodal convolution kernel of the target convolution layer; perform convolution calculation on the input of the target convolution layer through the multimodal convolution kernel in the target convolution layer to obtain the input of the post-network layer, and obtain the target image through layer-by-layer processing of the post-network layer.
[0095] The device further comprises:
[0096] A second acquisition unit, used to acquire first weight coefficients corresponding to each of the plurality of degradation factors input by a user;
[0097] A third acquisition unit, used to acquire a sample image pair, wherein the sample image pair includes an original image and a restored original image;
[0098] A training unit is used to train the neural network model to be trained according to the sample image pair, so as to adjust the first preset weights and the first weight coefficients corresponding to each of the degradation factors to obtain the pre-trained neural network model.
[0099] The present application provides an image processing device, which obtains an image to be processed, wherein the image to be processed includes an image with several degradation factors. The image to be processed is input into a pre-trained neural network model, and the pre-trained neural network model performs repair processing on the image to be processed to obtain a target image output by the pre-trained neural network model. Among them, the pre-trained neural network model contains a multimodal convolution kernel obtained according to the target preset weights and target weight coefficients corresponding to each of the several degradation factors; the multimodal convolution kernel is used to adjust the operation result of the target convolution layer. The present application obtains a multimodal convolution kernel based on the target preset weights and the target weight coefficients. Then, the operation result of the convolution layer is adjusted to improve the restoration strength between different degradation factors, thereby improving the ability to restore distorted images for several degradation factors.
[0100] It should be understood that the size of the serial numbers of the steps in the above embodiments does not 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.
[0101] Fig.10 FIG. 1 is a schematic diagram of a terminal device provided by an embodiment of the present application. Fig.10 As shown, a terminal device 100 of this embodiment includes: a processor 1000, a memory 1001, and a computer program 1002 stored in the memory 1001 and executable on the processor 1000, such as an image processing program. When the processor 1000 executes the computer program 1002, the steps in each of the above-mentioned image processing method embodiments are implemented, such as Figure 1 Alternatively, when the processor 1000 executes the computer program 1002, the functions of each unit in the above-mentioned device embodiments are realized, for example Fig. 9 Units 91 to 92 are shown.
[0102] Exemplarily, the computer program 1002 may be divided into one or more units, and the one or more units are stored in the memory 1001 and executed by the processor 1000 to complete the present application. The one or more units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 1002 in the terminal device 100. For example, the computer program 1002 may be divided into an acquisition unit and a calculation unit, and the specific functions of each unit are as follows:
[0103] A first acquisition unit, used to acquire an image to be processed, wherein the image to be processed includes an image with a plurality of degradation factors;
[0104] A processing unit, used for inputting the image to be processed into a pre-trained neural network model, and processing the image to be processed by the pre-trained neural network model to obtain a target image output by the pre-trained neural network model;
[0105] Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
[0106] The terminal device 100 may be a computing device such as a mobile terminal, a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 1000 and a memory 1001. Those skilled in the art may understand that Fig.10It is only an example of a terminal device 100 and does not constitute a limitation on the terminal device 100. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0107] The processor 1000 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 any conventional processor, etc.
[0108] The memory 1001 may be an internal storage unit of the terminal device 100, such as a hard disk or memory of the terminal device 100. The memory 1001 may also be an external storage device of the terminal device 100, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device 100. Further, the memory 1001 may also include both the internal storage unit of the terminal device 100 and the external storage device. The memory 1001 is used to store the computer program and other programs and data required by the terminal device. The memory 1001 may also be used to temporarily store data that has been output or is to be output.
[0109] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0110] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0111] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0112] In the embodiments provided in the present application, it should be understood that the disclosed terminal devices and methods can be implemented in other ways. For example, the terminal device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple 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.
[0114] 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.
[0115] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0116] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire an image to be processed, wherein the image to be processed includes an image having a plurality of degradation factors; Inputting the image to be processed into a pre-trained neural network model, and processing the image to be processed by the pre-trained neural network model to obtain a target image output by the pre-trained neural network model; Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
2. The method according to claim 1, characterized in that The neural network model includes a plurality of modules consisting of convolutional layers and activation functions, wherein the modules include a feature extraction module, a feature enhancement module and a reconstruction module, wherein the feature extraction module and / or the feature enhancement module includes a target convolutional layer; The step of inputting the image to be processed into a pre-trained neural network model, processing the image to be processed by the pre-trained neural network model, and obtaining a target image output by the pre-trained neural network model comprises: Processing the image to be processed layer by layer through the preceding network layer of the target convolutional layer to obtain the input of the target convolutional layer; Multiplying the target preset weight and the target weight coefficient corresponding to each degradation factor to obtain a plurality of products; Adding a plurality of the products to obtain a multimodal weight, and using the multimodal weight as the multimodal convolution kernel of the target convolution layer; The multimodal convolution kernel in the target convolution layer is used to perform convolution calculation on the input of the target convolution layer to obtain the input of the post-network layer, and the target image is obtained through layer-by-layer processing of the post-network layer.
3. The method according to claim 1, characterized in that Before obtaining the image to be processed, the method further includes: Obtaining first weight coefficients corresponding to each of the plurality of degradation factors input by a user; Acquire a sample image pair, wherein the sample image pair includes an original image and the original image after restoration processing; According to the sample image pairs, the neural network model to be trained is trained to adjust the first preset weights and the first weight coefficients corresponding to each of the several degradation factors to obtain the pre-trained neural network model, wherein the pre-trained neural network model includes the target preset weights corresponding to the first preset weights and the target weight coefficients corresponding to the first weight coefficients.
4. The method according to claim 3, characterized in that The step of training the neural network model to be trained according to the sample image pair to adjust the first preset weights and the first weight coefficients corresponding to the respective degradation factors to obtain the pre-trained neural network model comprises: According to the sample image pairs, the neural network model to be trained is trained to adjust the first preset weights corresponding to the degradation factors to obtain a first neural network model; According to the sample image pair, the first neural network model is trained to adjust the first weight coefficient and the second preset weight in the first neural network model to obtain the pre-trained neural network model, and the second preset weight is the weight obtained after the first preset weight is trained.
5. The method according to claim 4, characterized in that The step of training the neural network model to be trained according to the sample image pair to adjust the plurality of the first preset weights corresponding to the plurality of the degradation factors to obtain a first neural network model comprises: Using one of the first preset weights as a training object; Setting other first preset weights other than the first preset weight corresponding to the training object among the plurality of first preset weights to preset values; According to the sample image pairs, training the training object in the neural network model to be trained; Repeat the step of using one of the first preset weights as a training object and subsequent steps until the training of the first preset weights is completed to obtain the first neural network.
6. An image processing device, characterized in that: The device comprises: A first acquisition unit, used to acquire an image to be processed, wherein the image to be processed includes an image with a plurality of degradation factors; A processing unit, used for inputting the image to be processed into a pre-trained neural network model, and processing the image to be processed by the pre-trained neural network model to obtain a target image output by the pre-trained neural network model; Among them, the pre-trained neural network model includes a multimodal convolution kernel of a target convolution layer obtained according to target preset weights and target weight coefficients corresponding to each of the degradation factors, and the multimodal convolution kernel is used to extract features of the degradation factors.
7. The device according to claim 6, characterized in that The neural network model includes a plurality of modules consisting of convolutional layers and activation functions, wherein the modules include a feature extraction module, a feature enhancement module and a reconstruction module, wherein the feature extraction module and / or the feature enhancement module includes a target convolutional layer; The processing unit is specifically used to process the image to be processed layer by layer through the preceding network layer of the target convolution layer to obtain the input of the target convolution layer; multiply the target preset weight corresponding to each degradation factor and the target weight coefficient to obtain a plurality of products; add the plurality of products to obtain a multimodal weight, and use the multimodal weight as the multimodal convolution kernel of the target convolution layer; perform convolution calculation on the input of the target convolution layer through the multimodal convolution kernel in the target convolution layer to obtain the input of the post-network layer, and obtain the target image through layer-by-layer processing of the post-network layer.
8. The device according to claim 6, characterized in that The device further comprises: A second acquisition unit, used to acquire first weight coefficients corresponding to each of the plurality of degradation factors input by a user; A third acquisition unit, used to acquire a sample image pair, wherein the sample image pair includes an original image and a restored original image; A training unit is used to train the neural network model to be trained according to the sample image pair, so as to adjust the first preset weights and the first weight coefficients corresponding to each of the degradation factors to obtain the pre-trained neural network model.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
