WO2022247568A1 - Image restoration method and apparatus, and device - Google Patents

Image restoration method and apparatus, and device Download PDF

Info

Publication number
WO2022247568A1
WO2022247568A1 PCT/CN2022/089429 CN2022089429W WO2022247568A1 WO 2022247568 A1 WO2022247568 A1 WO 2022247568A1 CN 2022089429 W CN2022089429 W CN 2022089429W WO 2022247568 A1 WO2022247568 A1 WO 2022247568A1
Authority
WO
WIPO (PCT)
Prior art keywords
network
image
super
resolution
initial
Prior art date
Application number
PCT/CN2022/089429
Other languages
French (fr)
Chinese (zh)
Inventor
王伟
袁泽寰
王长虎
Original Assignee
北京有竹居网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京有竹居网络技术有限公司 filed Critical 北京有竹居网络技术有限公司
Publication of WO2022247568A1 publication Critical patent/WO2022247568A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4053Scaling of whole images or parts thereof, e.g. expanding or contracting based on super-resolution, i.e. the output image resolution being higher than the sensor resolution

Definitions

  • the invention belongs to the technical field of image processing, and in particular relates to an image restoration method, device and equipment.
  • high-quality images (such as high-resolution images) have important application value and Research prospects.
  • process of image acquisition, storage, and transmission will inevitably be limited by external conditions or other interferences, resulting in varying degrees of quality degradation of high-quality images. Then, restoring the degraded low-quality image to a high-quality image is an important part of computer vision tasks.
  • the methods used for image restoration can only realize image restoration for a specific degradation, but the degradation modes and degradation parameters that actually lead to low-quality images are various. Therefore, the current image restoration methods cannot universally realize the restoration effect of all low-quality images.
  • Embodiments of the present application provide an image restoration method, device, and equipment, which can restore various degraded low-quality images, and achieve image restoration effects with high generalization and practicability, so that it can be used for various computer vision tasks It is possible to provide high-quality data sources.
  • an image restoration method including:
  • the target condition network determine the first degradation feature of the first image, and the target condition network is used to extract the degradation feature of the image;
  • Adjust the parameters of the target super-resolution network according to the first degradation feature determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
  • a second image after restoration of the first image is obtained, and the quality of the second image is higher than that of the first image.
  • the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the sample database is based on high-quality samples
  • the sample database includes multiple types of samples, and each type of sample includes images obtained by using the same degradation mode and degradation parameters to degrade the images in the sample image set.
  • the degradation mode includes: at least one of resolution, noise, blur or compression.
  • the sample database includes the first type of samples and the second type of samples
  • the alternate training of the initial condition network and the initial super-resolution network using the various types of samples in the sample database respectively includes:
  • the updated initial condition network is the intermediate condition network
  • the updated initial super-resolution network is the intermediate condition network
  • the updated initial super-resolution network is the intermediate condition network
  • the sub-network is the intermediate super-divided network
  • using the first type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network including:
  • the initial super-resolution network is trained to obtain the intermediate super-resolution network.
  • the target conditional network includes a convolutional layer and an average pooling layer
  • the target super-resolution network includes a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
  • the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
  • the comparative loss function in the initial condition network corresponding to the target condition network includes:
  • the Lres is the reconstruction loss function
  • I LR is the input image of the initial super-resolution network Fsr
  • I HR is the image before I LR degradation
  • 1 is used to calculate the first-order norm
  • p( ⁇ ) is a sampling function
  • E is used to calculate expectations
  • the Linner is an internal class loss function
  • the Lcross is a cross class loss function
  • Lcon is a contrastive loss function
  • Xi , Xi ' and X j are the initial condition network
  • Xi i and Xi ' belong to the same class of samples
  • X j and Xi i belong to different classes of samples
  • p x ( ⁇ ) is the sampling function for the sample image set X
  • 2 is used to calculate 1 The square of the order norm.
  • the embodiment of the present application further provides an image restoration apparatus, and the apparatus may include: a first determining unit, a second determining unit, and an obtaining unit. in:
  • a first determining unit configured to determine a first degradation feature of the first image according to the first image to be restored and a target condition network, and the target condition network is used to extract the degradation feature of the image;
  • the second determination unit is configured to adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
  • An obtaining unit configured to obtain a second image restored from the first image according to the first image and the adjusted target super-resolution network, the quality of the second image is higher than that of the first image quality.
  • the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the sample database is based on high-quality samples
  • the sample database includes multiple types of samples, and each type of sample includes images obtained by using the same degradation mode and degradation parameters to degrade the images in the sample image set.
  • the degradation mode includes: at least one of resolution, noise, blur or compression.
  • the sample database includes the first type of samples and the second type of samples
  • the alternate training of the initial condition network and the initial super-resolution network using the various types of samples in the sample database respectively includes:
  • the updated initial condition network is the intermediate condition network
  • the updated initial super-resolution network is the intermediate condition network
  • the updated initial super-resolution network is the intermediate condition network
  • the sub-network is the intermediate super-divided network
  • using the first type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network including:
  • the initial super-resolution network is trained to obtain the intermediate super-resolution network.
  • the target conditional network includes a convolutional layer and an average pooling layer
  • the target super-resolution network includes a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
  • the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
  • the comparative loss function in the initial condition network corresponding to the target condition network includes:
  • the Lres is the reconstruction loss function
  • I LR is the input image of the initial super-resolution network Fsr
  • I HR is the image before I LR degradation
  • 1 is used to calculate the first-order norm
  • p( ⁇ ) is a sampling function
  • E is used to calculate expectations
  • the Linner is an internal class loss function
  • the Lcross is a cross class loss function
  • Lcon is a contrastive loss function
  • Xi , Xi ' and X j are the initial condition network
  • Xi i and Xi ' belong to the same class of samples
  • X j and Xi i belong to different classes of samples
  • p x ( ⁇ ) is the sampling function for the sample image set X
  • 2 is used to calculate 1 The square of the order norm.
  • the embodiment of the present application further provides an electronic device, where the electronic device includes: a processor and a memory;
  • said memory for storing instructions or computer programs
  • the processor is configured to execute the instruction or the computer program in the memory, so that the electronic device executes the method provided in the first aspect above.
  • the embodiment of the present application further provides a computer-readable storage medium, including instructions, which, when run on a computer, cause the computer to execute the method provided in the first aspect above.
  • the embodiment of the present application provides an image restoration method.
  • the image restoration device that executes the method, when restoring the first image with poor quality, first determines the A first degenerate feature of the first image.
  • the target conditional network is trained and used to extract the degenerated features of the image.
  • adjust the parameters of the target super-resolution network according to the first degradation feature and determine the adjusted target super-resolution network.
  • the target super-resolution network is trained and used to restore the quality of the image.
  • the device can obtain the second image restored from the first image according to the first image and the adjusted target super-resolution network.
  • the quality of the second image is higher than that of the first image.
  • the super-resolution network is adaptively adjusted by using the degradation characteristics describing the degradation of the image to be restored, and the image to be restored is restored by using the adjusted super-resolution network, which can correct various degradations.
  • the low-quality images under the model and degradation parameters are restored, and the image restoration effect with better generalization and practicability is achieved, thus providing a high-quality data source for various computer vision tasks.
  • FIG. 1 is a schematic flow chart of an image restoration method provided in an embodiment of the present application
  • FIG. 2 is a schematic diagram of an example of image restoration performed by an image restoration method provided in an embodiment of the present application
  • FIG. 3 is a schematic flow chart of a training process in an image restoration method provided in an embodiment of the present application
  • FIG. 4 is a schematic structural diagram of an initial condition network and an initial super-resolution network in an embodiment of the present application
  • FIG. 5 is a schematic flow diagram of a round of training for the initial condition network and the initial super-resolution network in the embodiment of the present application;
  • FIG. 6 is a schematic structural diagram of an image restoration device in an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device in an embodiment of the present application.
  • high-quality images will degrade during the process of acquisition, storage, transmission, etc.
  • the degradation modes include but are not limited to: resolution, blur, noise, and compression.
  • many computer vision tasks (such as video analysis, traffic supervision) need to be completed based on the rich information in high-quality images. Therefore, restoring low-quality images to high-quality images is very important for most computer vision tasks.
  • Image super-resolution technology is used to restore the details of low-quality images and obtain high-quality images that reflect more abundant information.
  • methods for image restoration using image super-resolution technology include but are not limited to: Method 1, reconstructing low-quality images degraded by a fixed degradation mode (eg, resolution degradation mode of triple downsampling).
  • the neural network is used to learn the mapping relationship between the low-quality image and the high-quality image in the fixed degradation mode, so as to restore the low-quality image degraded by the fixed degradation mode by means of the neural network.
  • this method 1 only supports the recovery of low-quality images degraded under a single degradation mode. Once a low-quality image is mixed with multiple degradation modes, the restoration performance will be greatly reduced, and high-quality images cannot be well restored.
  • Method two for low-quality images mixed with multiple degradation modes, a non-blind super-resolution algorithm is used for image restoration.
  • the specific process includes: taking each low-quality image in the sample and the degradation of the low-quality image (such as blur kernel, noise coefficient, etc.) as the input of the model, using the output high-quality image and the known corresponding High-quality images to train the model.
  • the degradation of the low-quality image to be restored is obtained by means of degradation estimation or manual adjustment, and the degradation and the low-quality image to be restored are input into the trained model, and the output is High-quality images recovered.
  • the second method can restore low-quality images degraded by various degradation modes, the degradation of the low-quality images to be restored is often not accurate enough.
  • the degradation situation is also inconsistent with the degradation situation of the sample image during the model training process, resulting in poor image restoration effect using the degradation situation and the trained model.
  • Method three for low-quality images mixed with multiple degradation modes, the blind super-resolution algorithm is used for image restoration.
  • the specific process includes: first, preprocessing operations such as denoising, deblurring, and artifact removal are performed on the low-quality image to be restored. Next, use the neural network in Method 1 to reconstruct the preprocessed image.
  • the third method can restore the low-quality images degraded by various degradation modes, because the degradation of the low-quality images to be restored is not completely consistent with the degradation of the sample images during the model training process, the third method cannot be applied to all low-quality images. Restoration of quality images.
  • the current image restoration methods all have the problems of poor generalization and practicability.
  • the embodiment of the present application provides an image restoration method, which can perform high-quality recovery on low-quality images under various degradation modes and degradation parameters. performance recovery.
  • the image restoration device implementing the method first determines the first degradation of the first image according to the first image to be restored and the target condition network when restoring the first image with poor quality feature.
  • the target conditional network is trained and used to extract the degenerated features of the image.
  • adjust the parameters of the target super-resolution network according to the first degradation feature and determine the adjusted target super-resolution network.
  • the target super-resolution network is trained and used to restore the quality of the image.
  • the device can obtain the second image restored from the first image according to the first image and the adjusted target super-resolution network.
  • the quality of the second image is higher than that of the first image.
  • the super-resolution network is adaptively adjusted by using the degradation characteristics describing the degradation of the picture to be restored, and the adjusted super-resolution network is used to restore the picture to be restored, and various degraded images can be recovered.
  • the low-quality images under the model and degradation parameters are restored, and the image restoration effect with better generalization and practicability is achieved, which makes it possible to provide high-quality images as data sources for various computer vision tasks.
  • the subject implementing the embodiment of the present application may be a device with the image restoration function provided by the embodiment of the present application, and the device may be carried on a terminal, which may be existing, under development or future development, Any user device capable of interacting with each other through any form of wired and/or wireless connection, including but not limited to: smart wearable devices, smartphones, non-smartphones, tablets, laptops, existing, in development, or in the future Desktop PCs, desktop PCs, minicomputers, midrange computers, mainframes, etc.
  • the device implementing the embodiment of the present application may also include a target conditional network and a target super-resolution network.
  • this figure is a schematic flow chart of an image restoration method provided by an embodiment of the present application. If it is necessary to restore the first image to be restored to obtain a high-quality second image, the method provided in the embodiment of the present application may be implemented. As shown in Figure 1, the method may include the following S101-S103:
  • S101 Determine a first degradation feature of the first image according to the first image to be restored and a target condition network, where the target condition network is used to extract the degradation feature of the image.
  • the first image may be any low-quality image to be restored, and the first image may be an image obtained by degrading the high-quality image through at least one unknown degradation mode.
  • the target condition network is a model obtained by training the initial condition network and used to extract the degraded features of the image to be restored.
  • the input of the target condition network is the image to be restored, and the output is the degraded feature of the image to be restored.
  • a target-conditioned network can include, for example, convolutional layers and average pooling layers.
  • the degradation feature of the image is used to describe the degradation condition of the image, and the degradation condition may include a degradation mode of the image and a degradation parameter corresponding to each degradation mode.
  • Degenerate features can be represented as an array, for example: [128, 1, 1].
  • S101 may include, for example, inputting the first image into the target condition network, the target condition network outputs a degraded feature, and the degraded feature is recorded as the first degraded feature corresponding to the first image.
  • S101 may also include, for example: dividing the first image into blocks to obtain several image blocks.
  • One or several image blocks among several image blocks are input into the target condition network.
  • the target condition network outputs a degradation feature, and the degradation feature is used to describe the degradation of the image block input by the target condition network, and is also used to describe the degradation of the first image. Therefore, the degraded feature can be recorded as the first degraded feature corresponding to the first image.
  • the first degradation feature that can describe the degradation of the first image is obtained, which is ready for the subsequent adjustment of the target super-resolution network and the recovery of the first image by using the adjusted target super-resolution network.
  • the target super-resolution network is a model used to restore image quality obtained by training the initial super-resolution network.
  • the input of the target super-resolution network is the image to be restored, and the output is the restored image.
  • the target super-resolution network may include, for example, a convolutional layer, a plurality of residual blocks, and an upsampling function, each residual block including a convolutional layer.
  • the process of adjusting the parameters of the target super-resolution network by using the first degraded feature in S102 may include, for example: taking the first degraded feature as the conditional input of the target super-resolution network, performing linear layer transformation on the first degraded feature, and then Multiplying the transformed degraded features and the convolutional layer parameters in the target super-resolution network, using the calculated product to update the parameters of the corresponding convolutional layer, to obtain the adjusted target super-resolution network.
  • the adaptive adjustment of the target super-resolution network by using the degradation characteristics describing the degradation of the picture to be restored is realized, which provides a data basis for restoring the first picture based on the adjusted target super-resolution network in S103, so that the The method makes it possible to restore low-quality images under various degradation modes and degradation parameters.
  • S103 may be, for example, inputting the first image into the target super-resolution network, and the image of the target super-resolution network is the second image in S103.
  • the second image is a result obtained by restoring the first image through the method provided in the embodiment of the present application, that is, the second image is a high-quality image corresponding to the first image.
  • the image on the right side of FIG. 2 (ie, the second image) can be obtained through the method provided in the embodiment of the present application. It can be seen from the comparison that the quality of the second image is higher than that of the first image.
  • the image quality mentioned in the embodiments of the present application is used to indicate the richness of information included in the image.
  • the quality of an image may be reflected by the resolution of the image. The higher the resolution of the image and the finer the details, the higher the quality of the image. Conversely, the lower the resolution of the image and the less details it reflects, the lower the quality of the image can be considered.
  • the target conditional network and the target super-resolution network can be used as two independent models in the image restoration device. Then, when executing the method, the image restoration device may first input the first image into the target condition network, and obtain the output of the target condition network—the first degraded feature. Next, the image restoration device inputs the first image and the first degraded feature into the target super-resolution network, and obtains the output of the target super-resolution network—the second image.
  • the target condition network and the target super-resolution network can be used as two units in an overall model in the image restoration device. Then, when executing the method, the image restoration device may input the first image into the overall model to obtain the output of the overall model—the second image. Wherein, the target condition network in the overall model first obtains the first degraded feature of the first image according to the first image. Next, the parameters of the target super-resolution network in the overall model are adjusted by using the first degenerate feature. Then, input the first image into the adjusted target super-resolution network in the overall model to obtain the second image.
  • the conditional network is first used to obtain the degradation features of the low-quality image, and then the degradation characteristics describing the degradation of the image to be restored are used.
  • the feature adaptively adjusts the super-resolution network, and then uses the adjusted super-resolution network to restore the picture to be restored.
  • this embodiment of the present application may also include the following S301-S302:
  • S301 Construct a sample database according to the high-quality sample image set, degradation mode and degradation parameter, the sample database includes multiple types of samples, and each type of sample includes the samples in the sample image set using the same degradation mode and degradation parameters The image obtained after the image is degraded.
  • a sample database is first constructed based on S301.
  • the sample database includes a wealth of samples to ensure the effectiveness and practicability of the trained target conditional network and target super-resolution network.
  • the images in the high-quality sample image set are degraded according to different combinations of degradation modes and degradation parameters, and a set of low-quality sample images degraded by various degradation modes and degradation parameters are obtained.
  • a set of low-quality sample images degraded by each degradation mode and degradation parameter is recorded as a class of samples, and multi-class samples are stored in the sample database to obtain the constructed sample database.
  • the images in the sample database are the initial condition network and the training data of the initial super-resolution network.
  • the degradation mode includes but not limited to: at least one of resolution, noise, blur or compression.
  • the degradation parameters may correspond to different downsampling multiples, such as 2 times, 4 times, . . . .
  • the degradation parameters can correspond to different Gaussian white noise coefficients, such as: 20, 30, . . . .
  • the degradation parameters can correspond to different Gaussian blur kernels, such as: 0.5, 1.5, ....
  • the degradation parameters can correspond to different compression algorithms.
  • the high-quality sample image set Y includes 10 images: HR0, HR1, . . . , HR9.
  • Combinations of degradation modes and degradation parameters include: combination 1 ⁇ Gaussian blur kernel G1, noise factor N1, downsampling multiple A1 ⁇ , combination 2 ⁇ Gaussian blur kernel G2, downsampling multiple A2 ⁇ , combination 3 ⁇ Gaussian blur kernel G1, noise Coefficient N1, downsampling multiple A3 and compression algorithm S ⁇ .
  • the sample database constructed through S301 may include: the first type sample X1, the second type sample X2 and the third type sample X3.
  • Each type of sample includes 10 low-quality images, and each low-quality image is obtained by degrading an image in a sample image set Y through a combination corresponding to the type of sample.
  • the first type of sample X1 corresponds to combination 1
  • the first type of sample X1 may include 10 images: LR10, LR11, . . . , LR19.
  • the second type of sample X2 corresponds to combination 2
  • the second type of sample X2 may include 10 images: LR20, LR21, . . . , LR29.
  • the third type of sample X3 corresponds to combination 3
  • the third type of sample X3 may include 10 images: LR30, LR31, . . . , LR39.
  • the LR10 may be an image obtained after HR0 is subjected to ⁇ G1 blur processing, ⁇ N1 noise processing and A1 downsampling. Among them, ⁇ is the variance.
  • the sample database obtained through S301 includes: the first type of sample X1 ⁇ LR10, LR11, ..., LR19 ⁇ -combination 1 ⁇ Gaussian blur kernel G1, noise factor N1, downsampling multiple A1 ⁇ , the second Class sample X2 ⁇ LR20, LR21,...,LR29 ⁇ -combination 2 ⁇ Gaussian blur kernel G2, downsampling multiple A2 ⁇ , and third class sample X3 ⁇ LR30, LR31,...,LR39 ⁇ -combination 3 ⁇ Gaussian blur Kernel G1, noise figure N1, downsampling multiple A3 and compression algorithm S ⁇ .
  • the initial condition network may include a convolutional layer and an average pooling layer
  • the initial super-resolution network may include a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
  • the initial condition network can adopt a structure of 4 convolutional layers and 2 average pooling layers.
  • the initial super-resolution network can use 2 layers of convolutional layers, 10 residual blocks (such as SRResNet-10) and 1 upsampling function (English: Upsampling).
  • the initial condition network 100 may include: a convolutional layer 1, a linear rectification function (English: ReLU) 1, a convolutional layer 2, a linear rectification function 2, an average pooling layer 1, and a convolutional layer 3 , linear rectification function 3, convolution layer 4, linear rectification function 4 and average pooling layer 2.
  • the parameters of convolutional layer 1 and convolutional layer 2 can be K3n64s1. That is, the scale of the convolutional layer 1 and the convolutional layer 2 is: the convolution kernel is 3, the channel is 64, and the step size is 1.
  • the parameters of average pooling layer 1 can be K2s2.
  • the size of the average pooling layer 1 is: the convolution kernel is 2, and the step size is 2.
  • the parameters of convolutional layer 3 and convolutional layer 4 can be K3n128s1. That is, the scales of the convolutional layer 3 and the convolutional layer 4 are: 3 convolution kernels, 128 channels, and 1 step.
  • the parameters of the average pooling layer 2 can be Kh/2sw/2. That is, the size of the average pooling layer 2 is: the convolution kernel is h/2, and the step size is w/2.
  • h and w are the height and width of the input image of the initial condition network 100 respectively.
  • the output of the initial condition network 100 is the degraded features of these n images [128,1,1].
  • the initial super-separation network 200 may include: fully connected layer 1, fully connected layer 2, ..., fully connected layer 20, residual block 1, residual block 2, ..., residual block 10, volume Product layer 5, convolutional layer 6 and upsampling function 1.
  • Each residual block includes 2 convolutional layers and a linear rectification function, for example, residual block 1 includes: convolutional layer 7, linear rectification function 5, and convolutional layer 8.
  • the inputs of the 20 fully connected layers are the degenerated features of the initial condition network 100 output, and the 20 outputs are respectively connected to the 20 convolutional layers of the 10 residual blocks, and the convolution in the fully connected layer and the residual block Layers correspond to each other.
  • the input of the initial super-resolution network 200 includes: conditional input and super-resolution input.
  • the conditional input is the degraded feature output by the initial condition network 100
  • the super-resolution input is an image belonging to the same sample as the image input by the initial condition network 100.
  • the super-resolution input passes through the convolutional layer 5, 10 residual blocks, the upper function 1 and the convolutional layer 6 in sequence to obtain the output of the initial super-resolution network, that is, the super-resolution input passes through the initial super-resolution network 200 for image restoration the resulting image.
  • the reconstruction loss function of the above-mentioned initial super-resolution network 200 can be expressed as the following formula (1):
  • Lres is a reconstruction loss function, and the Lres can combine the output image I SR of the initial super-resolution network 200 and the high-quality image I HR corresponding to the input image I LR to train the parameters of the initial super-resolution network 200 .
  • I LR is the input image of the initial super-resolution network Fsr 200
  • I HR is the image before I LR degradation
  • 1 is used to calculate the first-order norm
  • p( ⁇ ) is the sampling function
  • E is used to calculate expectations.
  • the comparative loss function in the initial condition network 100 may include the following formulas (2) to (4):
  • Linner is the inner class loss function
  • Lcross is the cross class loss function
  • Lcon is the contrastive loss function.
  • Xi , Xi ' and X j are the input images of the initial condition network Fc100
  • Xi and Xi ' belong to the same class of samples
  • X j and Xi belong to different classes of samples
  • p x ( ⁇ ) is the sampling function for the sample image set X
  • 2 is used to calculate the square of the 1st order norm.
  • each type of sample in the multi-type samples in the sample database it can be used to alternately train the initial condition network and the initial super-resolution network.
  • the training process of each type of sample is similar to the initial condition network and the initial super-resolution network. Therefore, the model training process in the embodiment of the present application will be described below by taking two types of samples in the sample database as an example to train the initial condition network and the initial super-resolution network.
  • S302 may include, for example: S3021, using the first type of samples, alternately training the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network.
  • S3022 Based on the intermediate condition network and the intermediate super-resolution network, update the initial condition network and the initial super-resolution network, the updated initial condition network is the intermediate condition network, and the updated initial super-resolution network is the intermediate super-resolution network.
  • S3023 Use the second type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the target condition network and the target super-resolution network.
  • the training process of the sub-network may include:
  • S501 may, for example, be that the image restoration apparatus first selects several (for example, 5) third images from the first type of samples.
  • the selected third image is input into the initial condition network, and the output of the initial condition network is the second degraded feature corresponding to the input multiple third images.
  • selecting the third image from the first type of samples may be selected randomly, or may be selected according to other possible preset rules, which is not limited in this embodiment of the present application.
  • the selected third images can also be divided into blocks, and one or more image blocks of each third image can be input into the initial condition network to obtain the second degradation feature. It should be noted that whether the input of the initial condition network is the third image or the image block of the third image can be determined according to the structure when the initial condition network is constructed. accomplish.
  • the image restoration device may use the second degraded feature output by the initial condition network as the input condition of the initial super-resolution network, output it to the initial super-resolution network, and adjust the convolutional layer in each residual block in the initial super-resolution network. parameters to get the adjusted initial super-resolution network. Taking the initial condition network 100 and the initial super-resolution network 200 shown in Fig.
  • the second degradation features are respectively input into the fully connected layer 1 to the fully connected layer 20, and the fully connected layer 1 to the fully connected layer 20 degenerate the second
  • the transformed results are respectively input to the convolutional layer in the residual block, multiplied by the parameters of the corresponding convolutional layer, and the product is used as the updated parameter of the convolutional layer.
  • the transformed result output by the fully connected layer 1 is input to the convolutional layer 7 in the residual block 1, and the updated parameters of the convolutional layer 7 are equal to the original parameters of the convolutional layer 7 and the output result of the fully connected layer 1. product.
  • the obtained initial super-resolution network is the "adjusted initial super-resolution network" in S502.
  • the image restoration device can select at least one fourth image from the first type of samples, and then use the fourth image as a super-resolution input and input it to the adjusted initial super-resolution network, and the output result of the initial super-resolution network is Fifth image.
  • the initial super-resolution network can also adjust the parameters in the initial super-resolution network based on the output result, the image corresponding to the fourth image in the high-quality sample image set and the reconstruction loss function, to obtain Updated initial super-resolution network.
  • the initial condition network may be trained based on the output result in S503 to obtain an intermediate condition network.
  • S504 may include, for example: S1, input several third images in the first type of samples into the initial condition network to obtain the second degradation feature.
  • S2. Input several sixth images in the first type of samples into the initial condition network to obtain the third degenerated features.
  • S3. Input several seventh images in the second type of samples into the initial condition network to obtain the fourth degraded feature.
  • S4. Determine the first result according to the second degenerate feature, the third degenerate feature and the internal class loss function, and determine the second result according to the second degenerate feature (or the third degenerate feature), the fourth degenerate feature and the cross-class loss function.
  • the parameters of the initial condition network are adjusted according to the first result, the second result and the comparative loss function to obtain the intermediate condition network.
  • the intermediate conditional network can be regarded as a trained conditional network, and several images in the first type of samples are input into the intermediate conditional network, and the initial super-resolution network is adjusted by using the degraded features output by the intermediate conditional network. And input any image in the first sample into the adjusted initial super-resolution network, and use the output image of the initial super-resolution network and the input image of the initial super-resolution network to correspond to each other in the high-quality sample image set Image and reconstruction loss function, adjust the parameters in the initial super-resolution network to obtain the intermediate super-resolution network.
  • the intermediate condition network and the intermediate super-resolution network obtained by using the first type of samples to train the initial condition network and the initial super-resolution network are obtained. Then, the intermediate condition network can be recorded as the initial condition network for the next update, and the intermediate super-resolution network can be recorded as the initial super-resolution network for the next update. Then, enter the next round of training.
  • next class of samples that have not participated in the training use the next class of samples that have not participated in the training to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network, and then return to execute "record the intermediate condition network as the next update
  • the initial condition network, the intermediate super-resolution network is recorded as the initial super-resolution network for the next update" and "using the next class of samples that have not participated in the training, alternately train the initial condition network and the initial super-resolution network, Obtain the intermediate conditional network and the intermediate super-resolution network".
  • the training of the initial super-resolution network and the initial condition network is ended, and the intermediate condition network and the intermediate super-resolution network obtained after the training of the last class of samples are recorded as the target condition network and Target hyperresolution network.
  • S3021 can be regarded as a round of training based on samples of the first type
  • S3023 can be regarded as another round of training based on samples of the second type.
  • the above S3021 to S3023 are specifically expressed by taking the example that the sample database only includes two types of samples (namely, the first type of samples and the second type of samples).
  • the input of the initial condition network is an image
  • the input of the target condition network can also be an image. If the input of the initial condition network is an image block in the image, then the input of the target condition network can also be an image block in the image.
  • initial condition network and the initial super-resolution network can be used as two independent models in the image restoration device.
  • the initial condition network and the initial super-resolution network can also be used as two units in an overall model in the image restoration device, which are not specifically limited in this embodiment of the present application.
  • the sample database, the initial condition network and the initial super-resolution network can be reasonably constructed, so that a reasonable network can be trained based on as many samples as possible, and the target applicable to various degradation situations can be obtained.
  • Conditional network and target super-resolution network The target condition network and the target super-resolution network have good generalization and practicability, which provide a basis for the recovery of complex images with unknown degradation conditions in the embodiment of the present application, and achieve better generalization and practicability. Image restoration effects, thus making it possible to provide high-quality images as data sources for various computer vision tasks.
  • the apparatus 900 may include: a first determining unit 601 , a second determining unit 602 and an obtaining unit 603 . in:
  • the first determining unit 601 is configured to determine a first degradation feature of the first image according to the first image to be restored and a target condition network, and the target condition network is used to extract the degradation feature of the image;
  • the second determination unit 602 is used to adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
  • An obtaining unit 603, configured to obtain a second image restored from the first image according to the first image and the adjusted target super-resolution network, and the quality of the second image is higher than that of the first image the quality of.
  • the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the sample database is based on high-quality samples
  • the sample database includes multiple types of samples, and each type of sample includes images obtained by using the same degradation mode and degradation parameters to degrade the images in the sample image set.
  • the degradation mode includes: at least one of resolution, noise, blur or compression.
  • the sample database includes the first type of samples and the second type of samples
  • the alternate training of the initial condition network and the initial super-resolution network using the various types of samples in the sample database respectively includes:
  • the updated initial condition network is the intermediate condition network
  • the updated initial super-resolution network is the intermediate condition network
  • the updated initial super-resolution network is the intermediate condition network
  • the sub-network is the intermediate super-divided network
  • using the first type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network including:
  • the target conditional network includes a convolutional layer and an average pooling layer
  • the target super-resolution network includes a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
  • the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
  • the comparative loss function in the initial condition network corresponding to the target condition network includes:
  • the Lres is the reconstruction loss function
  • I LR is the input image of the initial super-resolution network Fsr
  • I HR is the image before I LR degradation
  • 1 is used to calculate the first-order norm
  • p( ⁇ ) is a sampling function
  • E is used to calculate expectations
  • the Linner is an internal class loss function
  • the Lcross is a cross class loss function
  • Lcon is a contrastive loss function
  • Xi , Xi ' and X j are the initial condition network
  • Xi i and Xi ' belong to the same class of samples
  • X j and Xi i belong to different classes of samples
  • p x ( ⁇ ) is the sampling function for the sample image set X
  • 2 is used to calculate 1 The square of the order norm.
  • the device 600 corresponds to the method shown in the above-mentioned Fig. 1, Fig. 3 and Fig. 5, and the implementation of the device 600 and the effect achieved can refer to the implementation shown in the above-mentioned Fig. 1, Fig. 3 and Fig. 5 Description of the example.
  • the embodiment of the present application also provides an electronic device 700, as shown in FIG. 7 .
  • the electronic device 700 includes: a processor 701 and a memory 702; wherein:
  • the memory 702 is used to store instructions or computer programs
  • the processor 701 is configured to execute the instructions or computer programs in the memory 702, so that the electronic device executes the methods provided in the embodiments shown in FIG. 1 , FIG. 3 and FIG. 5 .
  • an embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when run on a computer, cause the computer to execute the methods provided in the above-mentioned embodiments shown in FIG. 1 , FIG. 3 and FIG. 5 .
  • each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments.
  • the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiment.
  • the device and system embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

Disclosed in the present application are an image restoration method and apparatus, and a device. The method comprises: determining a first degradation feature of a first image according to the first image to be restored and a target condition network; adjusting a parameter of a target super-resolution network according to the first degradation feature, and determining the adjusted target super-resolution network; and obtaining, according to the first image and the adjusted target super-resolution network, a second image after the first image is restored, the quality of the second image being higher than that of the first image. The target condition network is used for extracting a degradation feature of an image, and the target super-resolution network is used for restoring the quality of the image. In this way, the super-resolution network is adaptively adjusted by using a degradation feature describing the degradation situation of an image to be restored, and said image is restored by using the adjusted super-resolution network, such that low-quality images under degradation modes and degradation parameters can be restored, and an image restoration effect having relatively good generalization and practicability is realized, thereby providing a high-quality data source for computer vision tasks.

Description

一种图像恢复方法、装置和设备Image restoration method, device and equipment
本申请要求于2021年5月28日提交中国国家知识产权局、申请号为202110594614.7、发明名称为“一种图像恢复方法、装置和设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110594614.7 and the invention title "An Image Restoration Method, Device and Equipment" filed with the State Intellectual Property Office of China on May 28, 2021, the entire contents of which are incorporated by reference in this application.
技术领域technical field
本发明属于图像处理技术领域,具体涉及一种图像恢复方法、装置和设备。The invention belongs to the technical field of image processing, and in particular relates to an image restoration method, device and equipment.
背景技术Background technique
在各种计算机视觉任务(如视频分析、卫星监控、交通监管、刑事调查等应用)中,高质量的图像(如分辨率较高的图像)由于包含丰富的信息,所以具有重要的应用价值及研究前景。但是,在实际情况中,图像的采集、存储、传输等过程会不可避免受到外在条件限制或其它干扰,导致高质量的图像发生不同程度的质量退化。那么,将退化后的低质量图像恢复为高质量图像,是计算机视觉任务中重要的一环。In various computer vision tasks (such as video analysis, satellite monitoring, traffic supervision, criminal investigation, etc.), high-quality images (such as high-resolution images) have important application value and Research prospects. However, in actual situations, the process of image acquisition, storage, and transmission will inevitably be limited by external conditions or other interferences, resulting in varying degrees of quality degradation of high-quality images. Then, restoring the degraded low-quality image to a high-quality image is an important part of computer vision tasks.
目前,图像恢复所采用的方法,都只能针对某种特定的退化实现图像的恢复,而实际导致产生低质量图像的退化模式以及退化参数是多种多样的。所以,目前的图像恢复方法无法普适性的实现所有低质量图像恢复的效果。At present, the methods used for image restoration can only realize image restoration for a specific degradation, but the degradation modes and degradation parameters that actually lead to low-quality images are various. Therefore, the current image restoration methods cannot universally realize the restoration effect of all low-quality images.
基于此,亟待提供一种图像恢复方法,能够对各种退化模式以及退化参数下的低质量图像进行恢复。Based on this, it is urgent to provide an image restoration method capable of restoring low-quality images under various degradation modes and degradation parameters.
发明内容Contents of the invention
本申请实施例提供了一种图像恢复方法、装置和设备,能够对各种退化的低质量图像进行恢复,实现泛化性和实用性较高的图像恢复效果,从而使得为各种计算机视觉任务提供优质数据来源成为可能。Embodiments of the present application provide an image restoration method, device, and equipment, which can restore various degraded low-quality images, and achieve image restoration effects with high generalization and practicability, so that it can be used for various computer vision tasks It is possible to provide high-quality data sources.
第一方面,本申请实施例提供了一种图像恢复方法,包括:In the first aspect, the embodiment of the present application provides an image restoration method, including:
根据待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征,所述目标条件网络用于提取图像的退化特征;According to the first image to be restored and the target condition network, determine the first degradation feature of the first image, and the target condition network is used to extract the degradation feature of the image;
根据所述第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络,所述目标超分网络用于恢复图像的质量;Adjust the parameters of the target super-resolution network according to the first degradation feature, determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
根据所述第一图像和所述调整后的目标超分网络,获得所述第一图像恢复后的第二图像,所述第二图像的质量高于所述第一图像的质量。According to the first image and the adjusted target super-resolution network, a second image after restoration of the first image is obtained, and the quality of the second image is higher than that of the first image.
作为一个示例,所述目标超分网络和所述条件网络为分别利用样本数据库中的各类样本交替训练初始条件网络和初始超分网络获得的,其中,所述样本数据库为根据高质量的样本图像集合、退化模式和退化参数构建的,所述样本数据库中包括多类样本,每类样本中包括使用相同退化模式和退化参数对所述样本图像集合中的图像进行退化后所得的图像。As an example, the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the sample database is based on high-quality samples The sample database includes multiple types of samples, and each type of sample includes images obtained by using the same degradation mode and degradation parameters to degrade the images in the sample image set.
其中,所述退化模式包括:分辨率、噪声、模糊或压缩中的至少一种。Wherein, the degradation mode includes: at least one of resolution, noise, blur or compression.
作为一个示例,所述样本数据库中包括第一类样本和第二类样本,所述分别利用所述样本数据库中的各类样本,交替训练初始条件网络和初始超分网络,包括:As an example, the sample database includes the first type of samples and the second type of samples, and the alternate training of the initial condition network and the initial super-resolution network using the various types of samples in the sample database respectively includes:
利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络;Using the first type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network;
基于所述中间条件网络和所述中间超分网络,更新所述初始条件网络和所述初始超分网络,更新后的所述初始条件网络为所述中间条件网络,更新后的所述初始超分网络为所述中间超分网络;Based on the intermediate condition network and the intermediate super-resolution network, update the initial condition network and the initial super-resolution network, the updated initial condition network is the intermediate condition network, and the updated initial super-resolution network The sub-network is the intermediate super-divided network;
利用所述第二类样本,交替训练所述初始条件网络和所述初始超分网络,获得所述目标条件网络和所述目标超分网络。Using the second type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the target condition network and the target super-resolution network.
作为一个示例,所述利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络,包括:As an example, using the first type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network, including:
根据所述第一类样本中的多张第三图像和所述初始条件网络,确定第二退化特征;determining a second degradation feature according to a plurality of third images in the first type of samples and the initial condition network;
根据所述第二退化特征调整所述初始超分网络的参数,确定调整后的初始超分网络;adjusting the parameters of the initial super-resolution network according to the second degradation feature, and determining the adjusted initial super-resolution network;
根据所述第一类样本中的第四图像和所述调整后的初始超分网络,确定输出结果;Determine an output result according to the fourth image in the first type of samples and the adjusted initial super-resolution network;
基于所述输出结果,训练所述初始条件网络,获得所述中间条件网络;Based on the output result, train the initial condition network to obtain the intermediate condition network;
基于所述中间条件网络和所述第一类样本,训练所述初始超分网络,获得所述中间超分网络。Based on the intermediate condition network and the first type of samples, the initial super-resolution network is trained to obtain the intermediate super-resolution network.
其中,所述目标条件网络包括卷积层和平均池化层,所述目标超分网络包 括卷积层、多个残差块和上采样函数,每个残差块包括卷积层。Wherein, the target conditional network includes a convolutional layer and an average pooling layer, and the target super-resolution network includes a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
作为一个示例,所述目标超分网络对应的初始超分网络的重建损失函数为:As an example, the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
Figure PCTCN2022089429-appb-000001
Figure PCTCN2022089429-appb-000001
所述目标条件网络对应的初始条件网络中的对比损失函数包括:The comparative loss function in the initial condition network corresponding to the target condition network includes:
Figure PCTCN2022089429-appb-000002
Figure PCTCN2022089429-appb-000002
Figure PCTCN2022089429-appb-000003
Figure PCTCN2022089429-appb-000003
Figure PCTCN2022089429-appb-000004
Figure PCTCN2022089429-appb-000004
其中,所述Lres为重建损失函数,I LR为所述初始超分网络Fsr的输入图像,I HR为I LR退化前的图像,|||| 1用于计算1阶范数,p(τ)为采样函数,E用于计算期望,所述Linner为内部类损失函数,所述Lcross为交叉类损失函数,Lcon为对比损失函数,X i、X i’和X j为所述初始条件网络Fc的输入图像,X i和X i’属于相同类样本,X j与X i属于不同类样本,p x(τ)为针对样本图像集合X的采样函数,|||| 2用于计算1阶范数的平方。 Among them, the Lres is the reconstruction loss function, I LR is the input image of the initial super-resolution network Fsr, I HR is the image before I LR degradation, |||| 1 is used to calculate the first-order norm, p(τ ) is a sampling function, E is used to calculate expectations, the Linner is an internal class loss function, the Lcross is a cross class loss function, Lcon is a contrastive loss function, Xi , Xi ' and X j are the initial condition network The input image of Fc, Xi i and Xi ' belong to the same class of samples, X j and Xi i belong to different classes of samples, p x (τ) is the sampling function for the sample image set X, |||| 2 is used to calculate 1 The square of the order norm.
第二方面,本申请实施例还提供了一种图像恢复装置,所述装置可以包括:第一确定单元、第二确定单元和获得单元。其中:In a second aspect, the embodiment of the present application further provides an image restoration apparatus, and the apparatus may include: a first determining unit, a second determining unit, and an obtaining unit. in:
第一确定单元,用于根据待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征,所述目标条件网络用于提取图像的退化特征;A first determining unit, configured to determine a first degradation feature of the first image according to the first image to be restored and a target condition network, and the target condition network is used to extract the degradation feature of the image;
第二确定单元,用于根据所述第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络,所述目标超分网络用于恢复图像的质量;The second determination unit is configured to adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
获得单元,用于根据所述第一图像和所述调整后的目标超分网络,获得所述第一图像恢复后的第二图像,所述第二图像的质量高于所述第一图像的质量。An obtaining unit, configured to obtain a second image restored from the first image according to the first image and the adjusted target super-resolution network, the quality of the second image is higher than that of the first image quality.
作为一个示例,所述目标超分网络和所述条件网络为分别利用样本数据库中的各类样本交替训练初始条件网络和初始超分网络获得的,其中,所述样本数据库为根据高质量的样本图像集合、退化模式和退化参数构建的,所述样本数据库中包括多类样本,每类样本中包括使用相同退化模式和退化参数对所述样本图像集合中的图像进行退化后所得的图像。As an example, the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the sample database is based on high-quality samples The sample database includes multiple types of samples, and each type of sample includes images obtained by using the same degradation mode and degradation parameters to degrade the images in the sample image set.
其中,所述退化模式包括:分辨率、噪声、模糊或压缩中的至少一种。Wherein, the degradation mode includes: at least one of resolution, noise, blur or compression.
作为一个示例,所述样本数据库中包括第一类样本和第二类样本,所述分别利用所述样本数据库中的各类样本,交替训练初始条件网络和初始超分网络,包括:As an example, the sample database includes the first type of samples and the second type of samples, and the alternate training of the initial condition network and the initial super-resolution network using the various types of samples in the sample database respectively includes:
利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络;Using the first type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network;
基于所述中间条件网络和所述中间超分网络,更新所述初始条件网络和所述初始超分网络,更新后的所述初始条件网络为所述中间条件网络,更新后的所述初始超分网络为所述中间超分网络;Based on the intermediate condition network and the intermediate super-resolution network, update the initial condition network and the initial super-resolution network, the updated initial condition network is the intermediate condition network, and the updated initial super-resolution network The sub-network is the intermediate super-divided network;
利用所述第二类样本,交替训练所述初始条件网络和所述初始超分网络,获得所述目标条件网络和所述目标超分网络。Using the second type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the target condition network and the target super-resolution network.
作为一个示例,所述利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络,包括:As an example, using the first type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network, including:
根据所述第一类样本中的多张第三图像和所述初始条件网络,确定第二退化特征;determining a second degradation feature according to a plurality of third images in the first type of samples and the initial condition network;
根据所述第二退化特征调整所述初始超分网络的参数,确定调整后的初始超分网络;adjusting the parameters of the initial super-resolution network according to the second degradation feature, and determining the adjusted initial super-resolution network;
根据所述第一类样本中的第四图像和所述调整后的初始超分网络,确定输出结果;Determine an output result according to the fourth image in the first type of samples and the adjusted initial super-resolution network;
基于所述输出结果,训练所述初始条件网络,获得所述中间条件网络;Based on the output result, train the initial condition network to obtain the intermediate condition network;
基于所述中间条件网络和所述第一类样本,训练所述初始超分网络,获得所述中间超分网络。Based on the intermediate condition network and the first type of samples, the initial super-resolution network is trained to obtain the intermediate super-resolution network.
其中,所述目标条件网络包括卷积层和平均池化层,所述目标超分网络包括卷积层、多个残差块和上采样函数,每个残差块包括卷积层。Wherein, the target conditional network includes a convolutional layer and an average pooling layer, and the target super-resolution network includes a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
作为一个示例,所述目标超分网络对应的初始超分网络的重建损失函数为:As an example, the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
Figure PCTCN2022089429-appb-000005
Figure PCTCN2022089429-appb-000005
所述目标条件网络对应的初始条件网络中的对比损失函数包括:The comparative loss function in the initial condition network corresponding to the target condition network includes:
Figure PCTCN2022089429-appb-000006
Figure PCTCN2022089429-appb-000006
Figure PCTCN2022089429-appb-000007
Figure PCTCN2022089429-appb-000007
Figure PCTCN2022089429-appb-000008
Figure PCTCN2022089429-appb-000008
其中,所述Lres为重建损失函数,I LR为所述初始超分网络Fsr的输入图像,I HR为I LR退化前的图像,|||| 1用于计算1阶范数,p(τ)为采样函数,E用于计算期望,所述Linner为内部类损失函数,所述Lcross为交叉类损失函数,Lcon为对比损失函数,X i、X i’和X j为所述初始条件网络Fc的输入图像,X i和X i’属于相同类样本,X j与X i属于不同类样本,p x(τ)为针对样本图像集合X的采样函数,|||| 2用于计算1阶范数的平方。 Among them, the Lres is the reconstruction loss function, I LR is the input image of the initial super-resolution network Fsr, I HR is the image before I LR degradation, |||| 1 is used to calculate the first-order norm, p(τ ) is a sampling function, E is used to calculate expectations, the Linner is an internal class loss function, the Lcross is a cross class loss function, Lcon is a contrastive loss function, Xi , Xi ' and X j are the initial condition network The input image of Fc, Xi i and Xi ' belong to the same class of samples, X j and Xi i belong to different classes of samples, p x (τ) is the sampling function for the sample image set X, |||| 2 is used to calculate 1 The square of the order norm.
第三方面,本申请实施例还提供了一种电子设备,所述电子设备包括:处理器和存储器;In a third aspect, the embodiment of the present application further provides an electronic device, where the electronic device includes: a processor and a memory;
所述存储器,用于存储指令或计算机程序;said memory for storing instructions or computer programs;
所述处理器,用于执行所述存储器中的所述指令或计算机程序,以使得所述电子设备执行上述第一方面提供的方法。The processor is configured to execute the instruction or the computer program in the memory, so that the electronic device executes the method provided in the first aspect above.
第四方面,本申请实施例还提供了一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行上述第一方面提供的方法。In a fourth aspect, the embodiment of the present application further provides a computer-readable storage medium, including instructions, which, when run on a computer, cause the computer to execute the method provided in the first aspect above.
由此可见,本申请实施例具有如下有益效果:It can be seen that the embodiment of the present application has the following beneficial effects:
本申请实施例提供了一种图像恢复方法,执行该方法的图像恢复装置,在对质量较差的第一图像进行恢复时,先根据该待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征。该目标条件网络为训练完成的、用于提取图像的退化特征。接着,根据该第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络。该目标超分网络为训练完成的、用于恢复图像的质量。那么,该装置即可根据第一图像和调整后的目标超分网络,获得第一图像恢复后的第二图像。该第二图像的质量高于第一图像的质量。可见,通过本申请实施例提供的方法,利用描述待恢复图像退化情况的退化特征对超分网络进行自适应调整,使用调整后的超分网络对该待恢复图像进行恢复,能够对各种退化模式以及退化参数下的低质量图像进行恢复,实现了泛化性和实用性较好的图像恢复效果,从而为各种计算机视觉任务提供了优质的数据来源。The embodiment of the present application provides an image restoration method. The image restoration device that executes the method, when restoring the first image with poor quality, first determines the A first degenerate feature of the first image. The target conditional network is trained and used to extract the degenerated features of the image. Next, adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network. The target super-resolution network is trained and used to restore the quality of the image. Then, the device can obtain the second image restored from the first image according to the first image and the adjusted target super-resolution network. The quality of the second image is higher than that of the first image. It can be seen that through the method provided by the embodiment of the present application, the super-resolution network is adaptively adjusted by using the degradation characteristics describing the degradation of the image to be restored, and the image to be restored is restored by using the adjusted super-resolution network, which can correct various degradations. The low-quality images under the model and degradation parameters are restored, and the image restoration effect with better generalization and practicability is achieved, thus providing a high-quality data source for various computer vision tasks.
附图说明Description of drawings
附图用来提供对本发明的进一步理解,并且构成说明书的一部分,与本发明实施例一起用于解释本发明,并不构成对本发明的限制。在附图中:The accompanying drawings are used to provide a further understanding of the present invention, and constitute a part of the description, and are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention. In the attached picture:
图1为本申请实施例提供的一种图像恢复方法的流程示意图;FIG. 1 is a schematic flow chart of an image restoration method provided in an embodiment of the present application;
图2为本申请实施例提供的图像恢复方法进行图像恢复的示例的示意图;FIG. 2 is a schematic diagram of an example of image restoration performed by an image restoration method provided in an embodiment of the present application;
图3为本申请实施例提供的一种图像恢复方法中训练过程的流程示意图;FIG. 3 is a schematic flow chart of a training process in an image restoration method provided in an embodiment of the present application;
图4为本申请实施例中初始条件网络和初始超分网络的结构示意图;FIG. 4 is a schematic structural diagram of an initial condition network and an initial super-resolution network in an embodiment of the present application;
图5为本申请实施例中对初始条件网络和初始超分网络进行一轮训练的流程示意图;FIG. 5 is a schematic flow diagram of a round of training for the initial condition network and the initial super-resolution network in the embodiment of the present application;
图6为本申请实施例中一种图像恢复装置的结构示意图;FIG. 6 is a schematic structural diagram of an image restoration device in an embodiment of the present application;
图7为本申请实施例中一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device in an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请实施例作进一步详细的说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本申请,并非对本申请的限定。另外,还需要说明的是,为便于描述,附图中仅示出了与本申请相关的部分,并非全部结构。In order to make the above objects, features and advantages of the present application more obvious and understandable, the embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It can be understood that the specific embodiments described here are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only parts relevant to the present application are shown in the drawings, not all structures.
通常,高质量的图像在采集、存储、传输等过程会发生退化,退化的模式包括但不限于:分辨率、模糊、噪声、压缩。但是,许多计算机视觉任务(如视频分析、交通监管),需要基于高质量的图像中丰富的信息完成。所以,将低质量图像恢复为高质量图像对于大多数计算机视觉任务非常重要。Usually, high-quality images will degrade during the process of acquisition, storage, transmission, etc. The degradation modes include but are not limited to: resolution, blur, noise, and compression. However, many computer vision tasks (such as video analysis, traffic supervision) need to be completed based on the rich information in high-quality images. Therefore, restoring low-quality images to high-quality images is very important for most computer vision tasks.
图像超分技术,用于恢复出低质量图像的细节,得到体现更加丰富信息的高质量图像。目前,利用图像超分技术实现图像恢复的方法,包括但不限于:方法一,针对固定退化模式(例如三倍下采样的分辨率退化模式)退化的低质量图像进行重建。具体通过神经网络学习该固定退化模式下低质量图像和高质量图像之间的映射关系,从而借助该神经网络实现对该固定退化模式退化所得的低质量图像的恢复。但是,该方法一仅支持单一退化模式下退化所得的低质量图像的恢复。一旦低质量图像混合了多种退化模式,恢复性能就会大打折扣,无法很好的恢复出高质量图像。方法二,针对混合了多种退化模式的低质量图像,采用非盲超分算法进行图像恢复。具体过程包括:将样本中的各低质量图像和该低质量图像的退化情况(例如模糊核、噪声系数等)作为模型的输入,利用输出的高质量图像和已知的该低质量图像对应的高质量图像对模型进行 训练。在完成模型训练后,依靠退化估计或人工调节的方式得到待恢复的低质量图像的退化情况,将该退化情况和该待恢复的低质量图像输入训练完成的模型,输出即为根据该方法二恢复出的高质量图像。该方法二虽然能够对多种退化模式退化的低质量图像进行恢复,但是,待恢复的低质量图像的退化情况往往不够准确。该退化情况和模型训练过程中样本图像的退化情况也不一致,导致使用该退化情况和训练完成的模型恢复图像的效果不佳。方法三,针对混合了多种退化模式的低质量图像,采用盲超分算法进行图像恢复。具体过程包括:首先,对待恢复的低质量图像进行去噪声操作、去模糊、去伪影等预处理操作。接着,使用方法一中的神经网络对预处理后的图像进行重建。该方法三虽然能够对多种退化模式退化的低质量图像进行恢复,但是,由于待恢复的低质量图像和模型训练过程中样本图像的退化情况不完全一致,导致该方法三无法适用所有的低质量图像的恢复。综上,目前的图像恢复方法,均存在泛化性和实用性较差的问题。Image super-resolution technology is used to restore the details of low-quality images and obtain high-quality images that reflect more abundant information. At present, methods for image restoration using image super-resolution technology include but are not limited to: Method 1, reconstructing low-quality images degraded by a fixed degradation mode (eg, resolution degradation mode of triple downsampling). Specifically, the neural network is used to learn the mapping relationship between the low-quality image and the high-quality image in the fixed degradation mode, so as to restore the low-quality image degraded by the fixed degradation mode by means of the neural network. However, this method 1 only supports the recovery of low-quality images degraded under a single degradation mode. Once a low-quality image is mixed with multiple degradation modes, the restoration performance will be greatly reduced, and high-quality images cannot be well restored. Method two, for low-quality images mixed with multiple degradation modes, a non-blind super-resolution algorithm is used for image restoration. The specific process includes: taking each low-quality image in the sample and the degradation of the low-quality image (such as blur kernel, noise coefficient, etc.) as the input of the model, using the output high-quality image and the known corresponding High-quality images to train the model. After the model training is completed, the degradation of the low-quality image to be restored is obtained by means of degradation estimation or manual adjustment, and the degradation and the low-quality image to be restored are input into the trained model, and the output is High-quality images recovered. Although the second method can restore low-quality images degraded by various degradation modes, the degradation of the low-quality images to be restored is often not accurate enough. The degradation situation is also inconsistent with the degradation situation of the sample image during the model training process, resulting in poor image restoration effect using the degradation situation and the trained model. Method three, for low-quality images mixed with multiple degradation modes, the blind super-resolution algorithm is used for image restoration. The specific process includes: first, preprocessing operations such as denoising, deblurring, and artifact removal are performed on the low-quality image to be restored. Next, use the neural network in Method 1 to reconstruct the preprocessed image. Although the third method can restore the low-quality images degraded by various degradation modes, because the degradation of the low-quality images to be restored is not completely consistent with the degradation of the sample images during the model training process, the third method cannot be applied to all low-quality images. Restoration of quality images. In summary, the current image restoration methods all have the problems of poor generalization and practicability.
基于此,考虑到待恢复图像的退化模式和退化参数未知且退化情况复杂,所以,本申请实施例提供了一种图像恢复方法,能够对各种退化模式以及退化参数下的低质量图像进行高性能的恢复。具体而言,执行该方法的图像恢复装置,在利用对质量较差的第一图像进行恢复时,先根据该待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征。该目标条件网络为训练完成的、用于提取图像的退化特征。接着,根据该第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络。该目标超分网络为训练完成的、用于恢复图像的质量。那么,该装置即可根据第一图像和调整后的目标超分网络,获得第一图像恢复后的第二图像。该第二图像的质量高于第一图像的质量。Based on this, considering that the degradation mode and degradation parameters of the image to be restored are unknown and the degradation situation is complex, the embodiment of the present application provides an image restoration method, which can perform high-quality recovery on low-quality images under various degradation modes and degradation parameters. performance recovery. Specifically, the image restoration device implementing the method first determines the first degradation of the first image according to the first image to be restored and the target condition network when restoring the first image with poor quality feature. The target conditional network is trained and used to extract the degenerated features of the image. Next, adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network. The target super-resolution network is trained and used to restore the quality of the image. Then, the device can obtain the second image restored from the first image according to the first image and the adjusted target super-resolution network. The quality of the second image is higher than that of the first image.
这样,通过本申请实施例提供的方法,利用描述待恢复图片退化情况的退化特征对超分网络进行自适应调整,使用调整后的超分网络对该待恢复图片进行恢复,能够对各种退化模式以及退化参数下的低质量图像进行恢复,实现了泛化性和实用性较好的图像恢复效果,从而使得为各种计算机视觉任务提供高质量的图像作为数据来源成为可能。In this way, through the method provided by the embodiment of the present application, the super-resolution network is adaptively adjusted by using the degradation characteristics describing the degradation of the picture to be restored, and the adjusted super-resolution network is used to restore the picture to be restored, and various degraded images can be recovered. The low-quality images under the model and degradation parameters are restored, and the image restoration effect with better generalization and practicability is achieved, which makes it possible to provide high-quality images as data sources for various computer vision tasks.
需要说明的是,实施本申请实施例的主体可以为具有本申请实施例提供的图像恢复功能的装置,该装置可以承载于终端,该终端可以是现有的、正在研发的或将来研发的、能够通过任何形式的有线和/或无线连接相互交互的任何 用户设备,包括但不限于:现有的、正在研发的或将来研发的智能可穿戴设备、智能手机、非智能手机、平板电脑、膝上型个人计算机、桌面型个人计算机、小型计算机、中型计算机、大型计算机等。其中,实施本申请实施例的装置也可以包括目标条件网络和目标超分网络。It should be noted that the subject implementing the embodiment of the present application may be a device with the image restoration function provided by the embodiment of the present application, and the device may be carried on a terminal, which may be existing, under development or future development, Any user device capable of interacting with each other through any form of wired and/or wireless connection, including but not limited to: smart wearable devices, smartphones, non-smartphones, tablets, laptops, existing, in development, or in the future Desktop PCs, desktop PCs, minicomputers, midrange computers, mainframes, etc. Wherein, the device implementing the embodiment of the present application may also include a target conditional network and a target super-resolution network.
为便于理解本申请实施例提供的图像恢复方法的具体实现,下面将结合附图进行说明。In order to facilitate understanding of the specific implementation of the image restoration method provided by the embodiment of the present application, the following description will be made with reference to the accompanying drawings.
参见图1,该图为本申请实施例提供的一种图像恢复方法流程示意图。如果需要对待恢复的第一图像进行恢复得到高质量的第二图像,则,可以执行本申请实施例提供的该方法。如图1所示,该方法可以包括下述S101~S103:Referring to FIG. 1 , this figure is a schematic flow chart of an image restoration method provided by an embodiment of the present application. If it is necessary to restore the first image to be restored to obtain a high-quality second image, the method provided in the embodiment of the present application may be implemented. As shown in Figure 1, the method may include the following S101-S103:
S101,根据待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征,所述目标条件网络用于提取图像的退化特征。S101. Determine a first degradation feature of the first image according to the first image to be restored and a target condition network, where the target condition network is used to extract the degradation feature of the image.
其中,第一图像可以是待恢复的任意一张低质量图像,该第一图像可以是高质量图像经过未知的至少一种退化模式退化所得的图像。Wherein, the first image may be any low-quality image to be restored, and the first image may be an image obtained by degrading the high-quality image through at least one unknown degradation mode.
目标条件网络,是经过对初始条件网络进行训练得到的、用于提取待恢复图像的退化特征的模型。该目标条件网络的输入是待恢复图像,输出是该待恢复图像的退化特征。目标条件网络例如可以包括卷积层和平均池化层。其中,初始条件网络、目标条件网络的结构以及训练获得目标条件网络的相关描述可以参见下述图3以及图5所示实施例的介绍。The target condition network is a model obtained by training the initial condition network and used to extract the degraded features of the image to be restored. The input of the target condition network is the image to be restored, and the output is the degraded feature of the image to be restored. A target-conditioned network can include, for example, convolutional layers and average pooling layers. Wherein, the structure of the initial condition network, the target condition network and the relevant description of the training to obtain the target condition network can refer to the introduction of the embodiments shown in FIG. 3 and FIG. 5 below.
图像的退化特征,用于描述图像的退化情况,退化情况可以包括图像的退化模式以及各个退化模式对应的退化参数。退化特征可以表示为一个数组,例如:[128,1,1]。The degradation feature of the image is used to describe the degradation condition of the image, and the degradation condition may include a degradation mode of the image and a degradation parameter corresponding to each degradation mode. Degenerate features can be represented as an array, for example: [128, 1, 1].
作为一个示例,S101例如可以包括:将第一图像输入目标条件网络,该目标条件网络输出退化特征,将该退化特征记作该第一图像对应的第一退化特征。As an example, S101 may include, for example, inputting the first image into the target condition network, the target condition network outputs a degraded feature, and the degraded feature is recorded as the first degraded feature corresponding to the first image.
作为另一个示例,为了降低图像恢复过程中的计算量和时间,S101例如也可以包括:将第一图像进行分块,得到若干图像块。将若干图像块中的某个或某几个图像块输入目标条件网络。该目标条件网络输出退化特征,该退化特征用于描述该目标条件网络所输入的图像块的退化情况,也用于描述第一图像的退化情况。所以,可以将该退化特征记作该第一图像对应的第一退化特征。As another example, in order to reduce the calculation amount and time in the image restoration process, S101 may also include, for example: dividing the first image into blocks to obtain several image blocks. One or several image blocks among several image blocks are input into the target condition network. The target condition network outputs a degradation feature, and the degradation feature is used to describe the degradation of the image block input by the target condition network, and is also used to describe the degradation of the first image. Therefore, the degraded feature can be recorded as the first degraded feature corresponding to the first image.
经过S101获得能够描述第一图像退化情况的第一退化特征,为后续调整 目标超分网络以及利用调整后的目标超分网络实现对第一图像的恢复作好了准备。After S101, the first degradation feature that can describe the degradation of the first image is obtained, which is ready for the subsequent adjustment of the target super-resolution network and the recovery of the first image by using the adjusted target super-resolution network.
S102,根据所述第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络,所述目标超分网络用于恢复图像的质量。S102. Adjust parameters of a target super-resolution network according to the first degradation feature, and determine an adjusted target super-resolution network, where the target super-resolution network is used to restore image quality.
目标超分网络,是经过对初始超分网络进行训练得到的、用于恢复图像质量的模型,该目标超分网络的输入是待恢复图像,输出是恢复后的图像。目标超分网络例如可以包括卷积层、多个残差块和上采样函数,每个残差块包括卷积层。其中,初始超分网络、目标超分网络的结构以及训练获得目标超分网络的相关描述可以参见下述图3以及图5所示实施例的介绍。The target super-resolution network is a model used to restore image quality obtained by training the initial super-resolution network. The input of the target super-resolution network is the image to be restored, and the output is the restored image. The target super-resolution network may include, for example, a convolutional layer, a plurality of residual blocks, and an upsampling function, each residual block including a convolutional layer. Wherein, the structure of the initial super-resolution network, the target super-resolution network, and the relevant description of the target super-resolution network after training can refer to the introduction of the embodiments shown in FIG. 3 and FIG. 5 below.
具体实现时,S102中利用第一退化特征调整目标超分网络的参数的过程例如可以包括:将第一退化特征作为目标超分网络的条件输入,对第一退化特征进行线性层变换后,再将变换后的退化特征和目标超分网络中的卷积层参数相乘,用计算所得乘积更新对应卷积层的参数,获得所述调整后的目标超分网络。During specific implementation, the process of adjusting the parameters of the target super-resolution network by using the first degraded feature in S102 may include, for example: taking the first degraded feature as the conditional input of the target super-resolution network, performing linear layer transformation on the first degraded feature, and then Multiplying the transformed degraded features and the convolutional layer parameters in the target super-resolution network, using the calculated product to update the parameters of the corresponding convolutional layer, to obtain the adjusted target super-resolution network.
如此,通过S102实现了利用描述待恢复图片退化情况的退化特征对目标超分网络的自适应调整,为S103中基于调整后的目标超分网络对第一图片进行恢复提供了数据基础,使得该方法对各种退化模式以及退化参数下的低质量图像进行恢复成为可能。In this way, through S102, the adaptive adjustment of the target super-resolution network by using the degradation characteristics describing the degradation of the picture to be restored is realized, which provides a data basis for restoring the first picture based on the adjusted target super-resolution network in S103, so that the The method makes it possible to restore low-quality images under various degradation modes and degradation parameters.
S103,根据所述第一图像和所述调整后的目标超分网络,获得所述第一图像恢复后的第二图像,所述第二图像的质量高于所述第一图像的质量。S103. According to the first image and the adjusted target super-resolution network, obtain a second image after restoration of the first image, where the quality of the second image is higher than that of the first image.
具体实现时,S103例如可以是:将第一图像输入到目标超分网络,该目标超分网络的图像即为S103中的第二图像。第二图像为经过本申请实施例提供的方法对第一图像进行恢复得到的结果,即,该第二图像为第一图像对应的高质量图像。In specific implementation, S103 may be, for example, inputting the first image into the target super-resolution network, and the image of the target super-resolution network is the second image in S103. The second image is a result obtained by restoring the first image through the method provided in the embodiment of the present application, that is, the second image is a high-quality image corresponding to the first image.
例如,将图2左侧的图像作为第一图像,经过本申请实施例提供的方法,可以得到图2右侧的图像(即第二图像)。通过对比可知,该第二图像的质量高于第一图像的质量。For example, using the image on the left side of FIG. 2 as the first image, the image on the right side of FIG. 2 (ie, the second image) can be obtained through the method provided in the embodiment of the present application. It can be seen from the comparison that the quality of the second image is higher than that of the first image.
需要说明的是,本申请实施例中提及的图像的质量,用于指示图像包括的信息的丰富程度。例如,图像的质量可以通过图像的分辨率体现,图像的分辨率越高,体现的细节越精细,则可以认为该图像的质量越高。反之,图像的分 辨率越低,体现的细节越少,则可以认为该图像的质量越低。It should be noted that the image quality mentioned in the embodiments of the present application is used to indicate the richness of information included in the image. For example, the quality of an image may be reflected by the resolution of the image. The higher the resolution of the image and the finer the details, the higher the quality of the image. Conversely, the lower the resolution of the image and the less details it reflects, the lower the quality of the image can be considered.
在一些实现方式中,目标条件网络和目标超分网络可以作为图像恢复装置中两个独立的模型。那么,在执行该方法时,图像恢复装置可以先将第一图像输入目标条件网络,获得该目标条件网络的输出——第一退化特征。接着,图像恢复装置将第一图像和第一退化特征输入目标超分网络,获得该目标超分网络的输出——第二图像。In some implementations, the target conditional network and the target super-resolution network can be used as two independent models in the image restoration device. Then, when executing the method, the image restoration device may first input the first image into the target condition network, and obtain the output of the target condition network—the first degraded feature. Next, the image restoration device inputs the first image and the first degraded feature into the target super-resolution network, and obtains the output of the target super-resolution network—the second image.
在另一些实现方式中,目标条件网络和目标超分网络可以作为图像恢复装置中的一个整体模型中的两个单元。那么,在执行该方法时,图像恢复装置可以将第一图像输入到该整体模型中,获得该整体模型的输出——第二图像。其中,该整体模型中的目标条件网络先根据第一图像获得该第一图像的第一退化特征。接着,利用第一退化特征对该整体模型中的目标超分网络的参数进行调整。然后,将第一图像输入该整体模型中调整后的目标超分网络,获得第二图像。In other implementation manners, the target condition network and the target super-resolution network can be used as two units in an overall model in the image restoration device. Then, when executing the method, the image restoration device may input the first image into the overall model to obtain the output of the overall model—the second image. Wherein, the target condition network in the overall model first obtains the first degraded feature of the first image according to the first image. Next, the parameters of the target super-resolution network in the overall model are adjusted by using the first degenerate feature. Then, input the first image into the adjusted target super-resolution network in the overall model to obtain the second image.
可见,通过本申请实施例提供的方法,考虑到待恢复图像的退化模式和退化参数未知且退化情况复杂,先利用条件网络获得低质量图像的退化特征,再利用描述待恢复图片退化情况的退化特征对超分网络进行自适应调整,才使用调整后的超分网络对该待恢复图片进行恢复。这能够对各种退化模式以及退化参数下的低质量图像进行高性能的恢复,实现了泛化性和实用性较好的图像恢复效果,从而使得为各种计算机视觉任务提供高质量的图像作为数据来源成为可能。It can be seen that, through the method provided by the embodiment of the present application, considering that the degradation mode and degradation parameters of the image to be restored are unknown and the degradation situation is complex, the conditional network is first used to obtain the degradation features of the low-quality image, and then the degradation characteristics describing the degradation of the image to be restored are used. The feature adaptively adjusts the super-resolution network, and then uses the adjusted super-resolution network to restore the picture to be restored. This enables high-performance restoration of low-quality images under various degradation modes and degradation parameters, and achieves image restoration effects with better generalization and practicability, thus making it possible to provide high-quality images for various computer vision tasks as Data sources are possible.
可以理解的是,在图1所示实施例实施之前,还需要对构建的初始条件网络和初始超分网络进行训练以获得目标条件网络和目标超分网络。参见图3,在使用目标条件网络和目标超分网络执行上述S101~S103之前,本申请实施例还可以包括下述S301~S302:It can be understood that before the implementation of the embodiment shown in FIG. 1 , it is necessary to train the constructed initial condition network and initial super-resolution network to obtain the target condition network and target super-resolution network. Referring to Fig. 3, before performing the above S101-S103 using the target conditional network and the target super-resolution network, this embodiment of the present application may also include the following S301-S302:
S301,根据高质量的样本图像集合、退化模式和退化参数,构建样本数据库,所述样本数据库中包括多类样本,每类样本中包括使用相同退化模式和退化参数对所述样本图像集合中的图像进行退化后所得的图像。S301. Construct a sample database according to the high-quality sample image set, degradation mode and degradation parameter, the sample database includes multiple types of samples, and each type of sample includes the samples in the sample image set using the same degradation mode and degradation parameters The image obtained after the image is degraded.
为了使得训练所得的目标条件网络和目标超分网络能够适用各种退化情况下的低质量图像的恢复,本申请实施例中先基于S301构建样本数据库。该样本数据库中包括了丰富的样本,确保训练所得目标条件网络和目标超分网络 的使用效果和实用性。In order to make the trained target condition network and target super-resolution network applicable to the recovery of low-quality images under various degradation situations, in the embodiment of the present application, a sample database is first constructed based on S301. The sample database includes a wealth of samples to ensure the effectiveness and practicability of the trained target conditional network and target super-resolution network.
具体实现时,针对高质量的样本图像集合中的图像,分别按照不同的退化模式和退化参数的组合进行退化,得到各种退化模式和退化参数进行退化后的一组低质量样本图像。将每种退化模式和退化参数退化后的一组低质量样本图像记作一类样本,多类样本存入样本数据库中,得到构建的样本数据库,该样本数据库中的图像即为对初始条件网络和初始超分网络的训练数据。During specific implementation, the images in the high-quality sample image set are degraded according to different combinations of degradation modes and degradation parameters, and a set of low-quality sample images degraded by various degradation modes and degradation parameters are obtained. A set of low-quality sample images degraded by each degradation mode and degradation parameter is recorded as a class of samples, and multi-class samples are stored in the sample database to obtain the constructed sample database. The images in the sample database are the initial condition network and the training data of the initial super-resolution network.
其中,退化模式包括但不限于:分辨率、噪声、模糊或压缩中的至少一种。其中,退化模式包括分辨率时,退化参数可以对应不同的降采样倍数,如,2倍、4倍、……。退化模式包括噪声时,退化参数可以对应不同的高斯白噪声系数,如:20、30、……。退化模式包括模糊时,退化参数可以对应不同的高斯模糊核,如:0.5、1.5、……。退化模式包括压缩时,退化参数可以对应不同的压缩算法。Wherein, the degradation mode includes but not limited to: at least one of resolution, noise, blur or compression. Wherein, when the degradation mode includes resolution, the degradation parameters may correspond to different downsampling multiples, such as 2 times, 4 times, . . . . When the degradation mode includes noise, the degradation parameters can correspond to different Gaussian white noise coefficients, such as: 20, 30, . . . . When the degradation mode includes blur, the degradation parameters can correspond to different Gaussian blur kernels, such as: 0.5, 1.5, .... When the degradation mode includes compression, the degradation parameters can correspond to different compression algorithms.
需要说明的是,构建样本数据库时,可以预设不同的退化模式和退化参数组合。每个组合下对高质量的样本图像集合中的图像进行退化,得到该组合对应的一类样本。该类样本不仅包括采用该组合的退化模式和退化参数进行退化后所得的低质量图像,还包括该组合的退化模式和退化参数。It should be noted that when constructing the sample database, different degradation modes and combinations of degradation parameters can be preset. Under each combination, the images in the high-quality sample image set are degenerated to obtain a class of samples corresponding to the combination. This type of sample includes not only the low-quality image obtained after degrading by using the combination of the degradation mode and the degradation parameters, but also the combination of the degradation mode and the degradation parameters.
例如,假设高质量的样本图像集合Y包括10张图像:HR0、HR1、……、HR9。退化模式和退化参数的组合包括:组合1{高斯模糊核G1、噪声系数N1、下采样倍数A1}、组合2{高斯模糊核G2、下采样倍数A2}、组合3{高斯模糊核G1、噪声系数N1、下采样倍数A3和压缩算法S}。那么,经过S301构建所得的样本数据库可以包括:第一类样本X1、第二类样本X2和第三类样本X3。每类样本包括10张低质量图像,每张低质量图像为一张样本图像集合Y中的图像经过该类样本对应的组合进行退化后得到的。其中,第一类样本X1与组合1对应,该第一类样本X1可以包括10张图像:LR10、LR11、……、LR19。第二类样本X2与组合2对应,该第二类样本X2可以包括10张图像:LR20、LR21、……、LR29。第三类样本X3与组合3对应,该第三类样本X3可以包括10张图像:LR30、LR31、……、LR39。以LR10为例,该LR10可以是对HR0经过σG1的模糊处理、σN1的噪声处理和A1倍下采样后得到的图像。其中,σ为方差。For example, assume that the high-quality sample image set Y includes 10 images: HR0, HR1, . . . , HR9. Combinations of degradation modes and degradation parameters include: combination 1 {Gaussian blur kernel G1, noise factor N1, downsampling multiple A1}, combination 2 {Gaussian blur kernel G2, downsampling multiple A2}, combination 3 {Gaussian blur kernel G1, noise Coefficient N1, downsampling multiple A3 and compression algorithm S}. Then, the sample database constructed through S301 may include: the first type sample X1, the second type sample X2 and the third type sample X3. Each type of sample includes 10 low-quality images, and each low-quality image is obtained by degrading an image in a sample image set Y through a combination corresponding to the type of sample. Wherein, the first type of sample X1 corresponds to combination 1, and the first type of sample X1 may include 10 images: LR10, LR11, . . . , LR19. The second type of sample X2 corresponds to combination 2, and the second type of sample X2 may include 10 images: LR20, LR21, . . . , LR29. The third type of sample X3 corresponds to combination 3, and the third type of sample X3 may include 10 images: LR30, LR31, . . . , LR39. Taking LR10 as an example, the LR10 may be an image obtained after HR0 is subjected to σG1 blur processing, σN1 noise processing and A1 downsampling. Among them, σ is the variance.
该示例中,经过S301所得的样本数据库中包括:该第一类样本X1{LR10、 LR11、……、LR19}-组合1{高斯模糊核G1、噪声系数N1、下采样倍数A1}、第二类样本X2{LR20、LR21、……、LR29}-组合2{高斯模糊核G2、下采样倍数A2}、以及第三类样本X3{LR30、LR31、……、LR39}-组合3{高斯模糊核G1、噪声系数N1、下采样倍数A3和压缩算法S}。In this example, the sample database obtained through S301 includes: the first type of sample X1 {LR10, LR11, ..., LR19}-combination 1 {Gaussian blur kernel G1, noise factor N1, downsampling multiple A1}, the second Class sample X2{LR20, LR21,...,LR29}-combination 2{Gaussian blur kernel G2, downsampling multiple A2}, and third class sample X3{LR30, LR31,...,LR39}-combination 3{Gaussian blur Kernel G1, noise figure N1, downsampling multiple A3 and compression algorithm S}.
需要说明的是,在S302之前,还需要待训练的构建初始条件网络和初始超分网络。初始条件网络可以包括卷积层和平均池化层,初始超分网络可以包括卷积层、多个残差块和上采样函数,每个残差块包括卷积层。It should be noted that before S302, the initial condition network and the initial super-resolution network to be trained are also required. The initial condition network may include a convolutional layer and an average pooling layer, and the initial super-resolution network may include a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
作为一个示例,初始条件网络可以采用4层卷积层和2层平均池化层的结构。初始超分网络可以采用2层卷积层、10个残差块(如SRResNet-10)和1个上采样函数(英文:Upsampling)。As an example, the initial condition network can adopt a structure of 4 convolutional layers and 2 average pooling layers. The initial super-resolution network can use 2 layers of convolutional layers, 10 residual blocks (such as SRResNet-10) and 1 upsampling function (English: Upsampling).
例如,参见图4所示,初始条件网络100可以包括:卷积层1、线性整流函数(英文:ReLU)1、卷积层2、线性整流函数2、平均池化层1、卷积层3、线性整流函数3、卷积层4、线性整流函数4和平均池化层2。其中,卷积层1和卷积层2的参数可以是K3n64s1。即,该卷积层1和卷积层2的规模为:卷积核为3,通道为64,步长为1。平均池化层1的参数可以是K2s2。即,该平均池化层1的规模为:卷积核为2,步长为2。卷积层3和卷积层4的参数可以是K3n128s1。即,该卷积层3和卷积层4的规模为:卷积核为3,通道为128,步长为1。平均池化层2的参数可以是Kh/2sw/2。即,该平均池化层2的规模为:卷积核为h/2,步长为w/2。其中,h和w分别为该初始条件网络100输入图像的高度和宽度。该初始条件网络100的输入如果是某类样本中的n张图像中的高度为h宽度为w的图像块,通道为3,那么,该初始条件网络100输出的为这n张图像的退化特征[128,1,1]。For example, as shown in FIG. 4 , the initial condition network 100 may include: a convolutional layer 1, a linear rectification function (English: ReLU) 1, a convolutional layer 2, a linear rectification function 2, an average pooling layer 1, and a convolutional layer 3 , linear rectification function 3, convolution layer 4, linear rectification function 4 and average pooling layer 2. Among them, the parameters of convolutional layer 1 and convolutional layer 2 can be K3n64s1. That is, the scale of the convolutional layer 1 and the convolutional layer 2 is: the convolution kernel is 3, the channel is 64, and the step size is 1. The parameters of average pooling layer 1 can be K2s2. That is, the size of the average pooling layer 1 is: the convolution kernel is 2, and the step size is 2. The parameters of convolutional layer 3 and convolutional layer 4 can be K3n128s1. That is, the scales of the convolutional layer 3 and the convolutional layer 4 are: 3 convolution kernels, 128 channels, and 1 step. The parameters of the average pooling layer 2 can be Kh/2sw/2. That is, the size of the average pooling layer 2 is: the convolution kernel is h/2, and the step size is w/2. Wherein, h and w are the height and width of the input image of the initial condition network 100 respectively. If the input of the initial condition network 100 is an image block with a height of h and a width of w in n images of a certain type of sample, and the channel is 3, then the output of the initial condition network 100 is the degraded features of these n images [128,1,1].
仍然参见图4,初始超分网络200可以包括:全连接层1、全连接层2、……、全连接层20、残差块1、残差块2、……、残差块10、卷积层5、卷积层6和上采样函数1。每个残差块包括2个卷积层和一个线性整流函数,例如,残差块1包括:卷积层7、线性整流函数5和卷积层8。其中,20个全连接层的输入均为初始条件网络100输出的退化特征,20个输出分别连接到10个残差块的20个卷积层中,全连接层和残差块中的卷积层一一对应。初始超分网络200的输入包括:条件输入和超分输入。其中,条件输入为初始条件网络100输出的退化特征,超分输入为与初始条件网络100输入的图像属于同类样本的图 像。超分输入依次经过卷积层5、10个残差块、上采用函数1和卷积层6,获得该初始超分网络的输出,即,超分输入经过该初始超分网络200进行图像恢复得到的图像。Still referring to FIG. 4 , the initial super-separation network 200 may include: fully connected layer 1, fully connected layer 2, ..., fully connected layer 20, residual block 1, residual block 2, ..., residual block 10, volume Product layer 5, convolutional layer 6 and upsampling function 1. Each residual block includes 2 convolutional layers and a linear rectification function, for example, residual block 1 includes: convolutional layer 7, linear rectification function 5, and convolutional layer 8. Among them, the inputs of the 20 fully connected layers are the degenerated features of the initial condition network 100 output, and the 20 outputs are respectively connected to the 20 convolutional layers of the 10 residual blocks, and the convolution in the fully connected layer and the residual block Layers correspond to each other. The input of the initial super-resolution network 200 includes: conditional input and super-resolution input. Among them, the conditional input is the degraded feature output by the initial condition network 100, and the super-resolution input is an image belonging to the same sample as the image input by the initial condition network 100. The super-resolution input passes through the convolutional layer 5, 10 residual blocks, the upper function 1 and the convolutional layer 6 in sequence to obtain the output of the initial super-resolution network, that is, the super-resolution input passes through the initial super-resolution network 200 for image restoration the resulting image.
在一些实现方式中,上述初始超分网络200的重建损失函数可以表示为下述公式(1):In some implementations, the reconstruction loss function of the above-mentioned initial super-resolution network 200 can be expressed as the following formula (1):
Figure PCTCN2022089429-appb-000009
Figure PCTCN2022089429-appb-000009
其中,Lres为重建损失函数,该Lres可以结合初始超分网络200的输出图像I SR和输入图像I LR对应的高质量图像I HR,对初始超分网络200的参数进行训练。公式(1)中,I LR为初始超分网络Fsr 200的输入图像,I HR为I LR退化前的图像,|||| 1用于计算1阶范数,p(τ)为采样函数,E用于计算期望。 Wherein, Lres is a reconstruction loss function, and the Lres can combine the output image I SR of the initial super-resolution network 200 and the high-quality image I HR corresponding to the input image I LR to train the parameters of the initial super-resolution network 200 . In formula (1), I LR is the input image of the initial super-resolution network Fsr 200, I HR is the image before I LR degradation, |||| 1 is used to calculate the first-order norm, p(τ) is the sampling function, E is used to calculate expectations.
初始条件网络100中的对比损失函数可以包括下述公式(2)~公式(4):The comparative loss function in the initial condition network 100 may include the following formulas (2) to (4):
Figure PCTCN2022089429-appb-000010
Figure PCTCN2022089429-appb-000010
Figure PCTCN2022089429-appb-000011
Figure PCTCN2022089429-appb-000011
Figure PCTCN2022089429-appb-000012
Figure PCTCN2022089429-appb-000012
其中,Linner为内部类损失函数,Lcross为交叉类损失函数,Lcon为对比损失函数。上述公式(2)和公式(3)中,X i、X i’和X j为初始条件网络Fc100的输入图像,X i和X i’属于相同类样本,X j与X i属于不同类样本,p x(τ)为针对样本图像集合X的采样函数,|||| 2用于计算1阶范数的平方。 Among them, Linner is the inner class loss function, Lcross is the cross class loss function, and Lcon is the contrastive loss function. In the above formulas (2) and (3), Xi , Xi ' and X j are the input images of the initial condition network Fc100, Xi and Xi ' belong to the same class of samples, and X j and Xi belong to different classes of samples , p x (τ) is the sampling function for the sample image set X, and |||| 2 is used to calculate the square of the 1st order norm.
如此,不仅基于S301构建了样本数据库,还构建了待训练的初始条件网络和初始超分网络,为S302获得目标条件网络和目标超分网络作好了准备。In this way, not only the sample database is constructed based on S301, but also the initial condition network and the initial super-resolution network to be trained are constructed, which is ready for S302 to obtain the target condition network and target super-resolution network.
S302,分别利用所述样本数据库中的各类样本,交替训练初始条件网络和初始超分网络,获得所述目标条件网络和所述目标超分网络。S302. Using various samples in the sample database to alternately train an initial condition network and an initial super-resolution network to obtain the target condition network and the target super-resolution network.
针对样本数据库中的多类样本中的每类样本,均可以被用于交替训练初始条件网络和初始超分网络。每类样本对初始条件网络和初始超分网络的训练过程类似。所以,下文中以样本数据库中的两类样本对初始条件网络和初始超分网络进行训练为例,阐述本申请实施例中的模型训练过程。For each type of sample in the multi-type samples in the sample database, it can be used to alternately train the initial condition network and the initial super-resolution network. The training process of each type of sample is similar to the initial condition network and the initial super-resolution network. Therefore, the model training process in the embodiment of the present application will be described below by taking two types of samples in the sample database as an example to train the initial condition network and the initial super-resolution network.
具体实现时,假设样本数据库中包括第一类样本和第二类样本。那么,S302例如可以包括:S3021,利用第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络。S3022,基于中间条件网络和中间 超分网络,更新初始条件网络和初始超分网络,更新后的初始条件网络为中间条件网络,更新后的初始超分网络为中间超分网络。S3023,利用第二类样本,交替训练初始条件网络和初始超分网络,获得目标条件网络和所述目标超分网络。During specific implementation, it is assumed that the sample database includes samples of the first type and samples of the second type. Then, S302 may include, for example: S3021, using the first type of samples, alternately training the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network. S3022. Based on the intermediate condition network and the intermediate super-resolution network, update the initial condition network and the initial super-resolution network, the updated initial condition network is the intermediate condition network, and the updated initial super-resolution network is the intermediate super-resolution network. S3023. Use the second type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the target condition network and the target super-resolution network.
其中,每类样本对初始条件网络和初始超分网络的交替训练过程类似。所以,为了更加清楚的说明具体的训练过程,可以参见图5,以利用第一类样本交替训练初始条件网络和初始超分网络(S3021)为例,介绍每类样本对初始条件网络和初始超分网络的训练过程,例如可以包括:Among them, the alternate training process of each type of sample to the initial condition network and the initial super-resolution network is similar. Therefore, in order to illustrate the specific training process more clearly, you can refer to Figure 5, taking the use of the first type of samples to alternately train the initial condition network and the initial super-resolution network (S3021) as an example, and introduce the impact of each type of sample on the initial condition network and the initial super-resolution network. The training process of the sub-network, for example, may include:
S501,根据所述第一类样本中的多张第三图像和所述初始条件网络,确定第二退化特征。S501. Determine a second degradation feature according to multiple third images in the first type of samples and the initial condition network.
S502,根据所述第二退化特征调整所述初始超分网络的参数,确定调整后的初始超分网络。S502. Adjust parameters of the initial super-resolution network according to the second degradation feature, and determine an adjusted initial super-resolution network.
S503,根据所述第一类样本中的第四图像和所述调整后的初始超分网络,确定输出结果。S503. Determine an output result according to the fourth image in the first type of samples and the adjusted initial super-resolution network.
S504,基于所述输出结果,训练所述初始条件网络,获得所述中间条件网络。S504. Based on the output result, train the initial condition network to obtain the intermediate condition network.
S505,基于所述中间条件网络和所述第一类样本,训练所述初始超分网络,获得所述中间超分网络。S505. Based on the intermediate condition network and the first type of samples, train the initial super-resolution network to obtain the intermediate super-resolution network.
具体实现时,S501例如可以是图像恢复装置先从第一类样本中选择若干张(如5张)第三图像。将所选中的第三图像输入到初始条件网络中,该初始条件网络的输出即为所输入的多张第三图像对应的第二退化特征。其中,从第一类样本中选择第三图像,可以是随机选择,也可以是按照其他可能的预设规律选择,在本申请实施例中不作限定。可选地,为了节约运算资源,也可以将所选中的若干第三图像分别进行分块,并将每个第三图像的一个或多个图像块输入到初始条件网络中,以获得第二退化特征。需要说明的是,初始条件网络的输入是第三图像还是第三图像的图像块,可以根据初始条件网络构建时的结构确定,是否分块以及分块的大小,均不影响本申请实施例的实现。During specific implementation, S501 may, for example, be that the image restoration apparatus first selects several (for example, 5) third images from the first type of samples. The selected third image is input into the initial condition network, and the output of the initial condition network is the second degraded feature corresponding to the input multiple third images. Wherein, selecting the third image from the first type of samples may be selected randomly, or may be selected according to other possible preset rules, which is not limited in this embodiment of the present application. Optionally, in order to save computing resources, the selected third images can also be divided into blocks, and one or more image blocks of each third image can be input into the initial condition network to obtain the second degradation feature. It should be noted that whether the input of the initial condition network is the third image or the image block of the third image can be determined according to the structure when the initial condition network is constructed. accomplish.
接着,S502例如可以是图像恢复装置将初始条件网络输出的第二退化特征作为初始超分网络的输入条件,输出到初始超分网络,调整初始超分网络中各残差块中卷积层的参数,得到调整后的初始超分网络。以图4所示的初始条 件网络100和初始超分网络200为例,第二退化特征分别输入到全连接层1~全连接层20,全连接层1~全连接层20对该第二退化特征进行线性层变换后,分别将变换后的结果输入到残差块中的卷积层,与对应卷积层的参数相乘,乘积作为该卷积层更新后的参数。例如,全连接层1输出的变换后的结果输入残差块1中的卷积层7,卷积层7更新后的参数等于该卷积层7原来的参数和全连接层1输出的结果的乘积。如此,基于第二退化特征对各残差块中的卷积层的参数进行更新后,得到的初始超分网络即为该S502中“调整后的初始超分网络”。Next, in S502, for example, the image restoration device may use the second degraded feature output by the initial condition network as the input condition of the initial super-resolution network, output it to the initial super-resolution network, and adjust the convolutional layer in each residual block in the initial super-resolution network. parameters to get the adjusted initial super-resolution network. Taking the initial condition network 100 and the initial super-resolution network 200 shown in Fig. 4 as an example, the second degradation features are respectively input into the fully connected layer 1 to the fully connected layer 20, and the fully connected layer 1 to the fully connected layer 20 degenerate the second After the features are transformed by the linear layer, the transformed results are respectively input to the convolutional layer in the residual block, multiplied by the parameters of the corresponding convolutional layer, and the product is used as the updated parameter of the convolutional layer. For example, the transformed result output by the fully connected layer 1 is input to the convolutional layer 7 in the residual block 1, and the updated parameters of the convolutional layer 7 are equal to the original parameters of the convolutional layer 7 and the output result of the fully connected layer 1. product. In this way, after updating the parameters of the convolutional layers in each residual block based on the second degradation feature, the obtained initial super-resolution network is the "adjusted initial super-resolution network" in S502.
然后,图像恢复装置可以从第一类样本中选择至少一张第四图像,然后将该第四图像作为超分输入,输入到调整后的初始超分网络,该初始超分网络的输出结果为第五图像。那么,S503和S504之间,初始超分网络还可以基于该输出结果、该第四图像在高质量的样本图像集合中对应的图像和重建损失函数,调整该初始超分网络中的参数,得到更新的初始超分网络。Then, the image restoration device can select at least one fourth image from the first type of samples, and then use the fourth image as a super-resolution input and input it to the adjusted initial super-resolution network, and the output result of the initial super-resolution network is Fifth image. Then, between S503 and S504, the initial super-resolution network can also adjust the parameters in the initial super-resolution network based on the output result, the image corresponding to the fourth image in the high-quality sample image set and the reconstruction loss function, to obtain Updated initial super-resolution network.
接着,S504中例如可以基于S503中的输出结果训练初始条件网络,获得中间条件网络。作为一个示例,S504例如可以包括:S1,将第一类样本中的若干第三图像输入初始条件网络获得第二退化特征。S2,将第一类样本中的若干第六图像输入初始条件网络获得第三退化特征。S3,将第二类样本中的若干第七图像输入初始条件网络获得第四退化特征。S4,根据第二退化特征、第三退化特征和内部类损失函数确定第一结果,根据第二退化特征(或第三退化特征)、第四退化特征和交叉类损失函数确定第二结果。从而,根据第一结果、第二结果和对比损失函数调整初始条件网络的参数,得到中间条件网络。Next, in S504, for example, the initial condition network may be trained based on the output result in S503 to obtain an intermediate condition network. As an example, S504 may include, for example: S1, input several third images in the first type of samples into the initial condition network to obtain the second degradation feature. S2. Input several sixth images in the first type of samples into the initial condition network to obtain the third degenerated features. S3. Input several seventh images in the second type of samples into the initial condition network to obtain the fourth degraded feature. S4. Determine the first result according to the second degenerate feature, the third degenerate feature and the internal class loss function, and determine the second result according to the second degenerate feature (or the third degenerate feature), the fourth degenerate feature and the cross-class loss function. Thus, the parameters of the initial condition network are adjusted according to the first result, the second result and the comparative loss function to obtain the intermediate condition network.
此时,可以将中间条件网络视作训练好的条件网络,将第一类样本中的若干图像输入到该中间条件网络中,利用该中间条件网络输出的退化特征调整初始超分网络。并将该第一样本中的任意一张图像输入调整后的初始超分网络,利用该初始超分网络的输出图像和该初始超分网络的输入图像在高质量的样本图像集合中对应的图像和重建损失函数,调整该初始超分网络中的参数,得到中间超分网络。At this time, the intermediate conditional network can be regarded as a trained conditional network, and several images in the first type of samples are input into the intermediate conditional network, and the initial super-resolution network is adjusted by using the degraded features output by the intermediate conditional network. And input any image in the first sample into the adjusted initial super-resolution network, and use the output image of the initial super-resolution network and the input image of the initial super-resolution network to correspond to each other in the high-quality sample image set Image and reconstruction loss function, adjust the parameters in the initial super-resolution network to obtain the intermediate super-resolution network.
可见,通过上述S501~S505的实现方式,获得了利用第一类样本训练初始条件网络和初始超分网络所得的中间条件网络和中间超分网络。接着,可以将中间条件网络记作下次更新的初始条件网络,将中间超分网络记作下次更新 的初始超分网络。然后,进入下一轮训练。例如,利用未参与训练的下一类样本,交替训练所述初始条件网络和所述初始超分网络,获得中间条件网络和中间超分网络,接着返回执行“将中间条件网络记作下次更新的初始条件网络,将中间超分网络记作下次更新的初始超分网络”以及“利用所述未参与训练的下一类样本,交替训练所述初始条件网络和所述初始超分网络,获得中间条件网络和中间超分网络”。直到样本数据库中的所有类样本均参与训练,结束对该初始超分网络和初始条件网络的训练,将最后一类样本训练后的所得的中间条件网络和中间超分网络记作目标条件网络和目标超分网络。It can be seen that through the implementation of S501-S505 above, the intermediate condition network and the intermediate super-resolution network obtained by using the first type of samples to train the initial condition network and the initial super-resolution network are obtained. Then, the intermediate condition network can be recorded as the initial condition network for the next update, and the intermediate super-resolution network can be recorded as the initial super-resolution network for the next update. Then, enter the next round of training. For example, use the next class of samples that have not participated in the training to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network, and then return to execute "record the intermediate condition network as the next update The initial condition network, the intermediate super-resolution network is recorded as the initial super-resolution network for the next update" and "using the next class of samples that have not participated in the training, alternately train the initial condition network and the initial super-resolution network, Obtain the intermediate conditional network and the intermediate super-resolution network". Until all the class samples in the sample database participate in the training, the training of the initial super-resolution network and the initial condition network is ended, and the intermediate condition network and the intermediate super-resolution network obtained after the training of the last class of samples are recorded as the target condition network and Target hyperresolution network.
需要说明的是,上述S3021可以视作基于第一类样本的一轮训练,S3023可以视作基于第二类样本的另一轮训练。上述S3021~S3023具体是以样本数据库仅包括两类样本(即第一类样本和第二类样本)为例的表述。It should be noted that the above S3021 can be regarded as a round of training based on samples of the first type, and S3023 can be regarded as another round of training based on samples of the second type. The above S3021 to S3023 are specifically expressed by taking the example that the sample database only includes two types of samples (namely, the first type of samples and the second type of samples).
需要说明的是,如果初始条件网络的输入是图像,那么,目标条件网络的输入也可以为图像。如果初始条件网络的输入是图像中的图像块,那么,目标条件网络的输入也可以为图像中的图像块。It should be noted that if the input of the initial condition network is an image, then the input of the target condition network can also be an image. If the input of the initial condition network is an image block in the image, then the input of the target condition network can also be an image block in the image.
需要说明的是,初始条件网络和初始超分网络可以作为图像恢复装置中两个独立的模型。或者,初始条件网络和初始超分网络也可以作为图像恢复装置中的一个整体模型中的两个单元,在本申请实施例不作具体限定。It should be noted that the initial condition network and the initial super-resolution network can be used as two independent models in the image restoration device. Alternatively, the initial condition network and the initial super-resolution network can also be used as two units in an overall model in the image restoration device, which are not specifically limited in this embodiment of the present application.
可见,通过本申请实施例提供的方法,能够合理的构建样本数据库、初始条件网络和初始超分网络,使得基于尽可能丰富的样本对合理的网络进行训练,得到适用于各种退化情况的目标条件网络和目标超分网络。该目标条件网络和目标超分网络具有良好的泛化性和实用性,为本申请实施例中对退化情况未知且复杂的图像的恢复提供了基础,实现了泛化性和实用性较好的图像恢复效果,从而使得为各种计算机视觉任务提供高质量的图像作为数据来源成为可能。It can be seen that through the method provided by the embodiment of the present application, the sample database, the initial condition network and the initial super-resolution network can be reasonably constructed, so that a reasonable network can be trained based on as many samples as possible, and the target applicable to various degradation situations can be obtained. Conditional network and target super-resolution network. The target condition network and the target super-resolution network have good generalization and practicability, which provide a basis for the recovery of complex images with unknown degradation conditions in the embodiment of the present application, and achieve better generalization and practicability. Image restoration effects, thus making it possible to provide high-quality images as data sources for various computer vision tasks.
相应的,本申请实施例还提供了一种图像恢复装置600,如图6所示。该装置900可以包括:第一确定单元601、第二确定单元602和获得单元603。其中:Correspondingly, the embodiment of the present application also provides an image restoration apparatus 600, as shown in FIG. 6 . The apparatus 900 may include: a first determining unit 601 , a second determining unit 602 and an obtaining unit 603 . in:
第一确定单元601,用于根据待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征,所述目标条件网络用于提取图像的退化特征;The first determining unit 601 is configured to determine a first degradation feature of the first image according to the first image to be restored and a target condition network, and the target condition network is used to extract the degradation feature of the image;
第二确定单元602,用于根据所述第一退化特征调整目标超分网络的参 数,确定调整后的目标超分网络,所述目标超分网络用于恢复图像的质量;The second determination unit 602 is used to adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
获得单元603,用于根据所述第一图像和所述调整后的目标超分网络,获得所述第一图像恢复后的第二图像,所述第二图像的质量高于所述第一图像的质量。An obtaining unit 603, configured to obtain a second image restored from the first image according to the first image and the adjusted target super-resolution network, and the quality of the second image is higher than that of the first image the quality of.
作为一个示例,所述目标超分网络和所述条件网络为分别利用样本数据库中的各类样本交替训练初始条件网络和初始超分网络获得的,其中,所述样本数据库为根据高质量的样本图像集合、退化模式和退化参数构建的,所述样本数据库中包括多类样本,每类样本中包括使用相同退化模式和退化参数对所述样本图像集合中的图像进行退化后所得的图像。As an example, the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the sample database is based on high-quality samples The sample database includes multiple types of samples, and each type of sample includes images obtained by using the same degradation mode and degradation parameters to degrade the images in the sample image set.
其中,所述退化模式包括:分辨率、噪声、模糊或压缩中的至少一种。Wherein, the degradation mode includes: at least one of resolution, noise, blur or compression.
作为一个示例,所述样本数据库中包括第一类样本和第二类样本,所述分别利用所述样本数据库中的各类样本,交替训练初始条件网络和初始超分网络,包括:As an example, the sample database includes the first type of samples and the second type of samples, and the alternate training of the initial condition network and the initial super-resolution network using the various types of samples in the sample database respectively includes:
利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络;Using the first type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network;
基于所述中间条件网络和所述中间超分网络,更新所述初始条件网络和所述初始超分网络,更新后的所述初始条件网络为所述中间条件网络,更新后的所述初始超分网络为所述中间超分网络;Based on the intermediate condition network and the intermediate super-resolution network, update the initial condition network and the initial super-resolution network, the updated initial condition network is the intermediate condition network, and the updated initial super-resolution network The sub-network is the intermediate super-divided network;
利用所述第二类样本,交替训练所述初始条件网络和所述初始超分网络,获得所述目标条件网络和所述目标超分网络。Using the second type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the target condition network and the target super-resolution network.
作为一个示例,所述利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络,包括:As an example, using the first type of samples to alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network, including:
根据所述第一类样本中的多张第三图像和所述初始条件网络,确定第二退化特征;determining a second degradation feature according to a plurality of third images in the first type of samples and the initial condition network;
根据所述第二退化特征调整所述初始超分网络的参数,确定调整后的初始超分网络;adjusting the parameters of the initial super-resolution network according to the second degradation feature, and determining the adjusted initial super-resolution network;
根据所述第一类样本中的第四图像和所述调整后的初始超分网络,确定输出结果;Determine an output result according to the fourth image in the first type of samples and the adjusted initial super-resolution network;
基于所述输出结果,训练所述初始条件网络,获得所述中间条件网络;Based on the output result, train the initial condition network to obtain the intermediate condition network;
基于所述中间条件网络和所述第一类样本,训练所述初始超分网络,获得 所述中间超分网络。Based on the intermediate condition network and the first type of samples, train the initial super-resolution network to obtain the intermediate super-resolution network.
其中,所述目标条件网络包括卷积层和平均池化层,所述目标超分网络包括卷积层、多个残差块和上采样函数,每个残差块包括卷积层。Wherein, the target conditional network includes a convolutional layer and an average pooling layer, and the target super-resolution network includes a convolutional layer, a plurality of residual blocks and an upsampling function, and each residual block includes a convolutional layer.
作为一个示例,所述目标超分网络对应的初始超分网络的重建损失函数为:As an example, the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
Figure PCTCN2022089429-appb-000013
Figure PCTCN2022089429-appb-000013
所述目标条件网络对应的初始条件网络中的对比损失函数包括:The comparative loss function in the initial condition network corresponding to the target condition network includes:
Figure PCTCN2022089429-appb-000014
Figure PCTCN2022089429-appb-000014
Figure PCTCN2022089429-appb-000015
Figure PCTCN2022089429-appb-000015
Figure PCTCN2022089429-appb-000016
Figure PCTCN2022089429-appb-000016
其中,所述Lres为重建损失函数,I LR为所述初始超分网络Fsr的输入图像,I HR为I LR退化前的图像,|||| 1用于计算1阶范数,p(τ)为采样函数,E用于计算期望,所述Linner为内部类损失函数,所述Lcross为交叉类损失函数,Lcon为对比损失函数,X i、X i’和X j为所述初始条件网络Fc的输入图像,X i和X i’属于相同类样本,X j与X i属于不同类样本,p x(τ)为针对样本图像集合X的采样函数,|||| 2用于计算1阶范数的平方。 Among them, the Lres is the reconstruction loss function, I LR is the input image of the initial super-resolution network Fsr, I HR is the image before I LR degradation, |||| 1 is used to calculate the first-order norm, p(τ ) is a sampling function, E is used to calculate expectations, the Linner is an internal class loss function, the Lcross is a cross class loss function, Lcon is a contrastive loss function, Xi , Xi ' and X j are the initial condition network The input image of Fc, Xi i and Xi ' belong to the same class of samples, X j and Xi i belong to different classes of samples, p x (τ) is the sampling function for the sample image set X, |||| 2 is used to calculate 1 The square of the order norm.
需要说明的是,该装置600与上述图1、图3以及图5所示的方法对应,该装置600的实现方式以及达到的效果,可以参见上述图1、图3以及图5所示的实施例的相关描述。It should be noted that the device 600 corresponds to the method shown in the above-mentioned Fig. 1, Fig. 3 and Fig. 5, and the implementation of the device 600 and the effect achieved can refer to the implementation shown in the above-mentioned Fig. 1, Fig. 3 and Fig. 5 Description of the example.
此外,本申请实施例还提供了一种电子设备700,如图7所示。该电子设备700包括:处理器701和存储器702;其中:In addition, the embodiment of the present application also provides an electronic device 700, as shown in FIG. 7 . The electronic device 700 includes: a processor 701 and a memory 702; wherein:
所述存储器702,用于存储指令或计算机程序;The memory 702 is used to store instructions or computer programs;
所述处理器701,用于执行所述存储器702中的所述指令或计算机程序,以使得所述电子设备执行上述图1、图3以及图5所示的实施例提供的方法。The processor 701 is configured to execute the instructions or computer programs in the memory 702, so that the electronic device executes the methods provided in the embodiments shown in FIG. 1 , FIG. 3 and FIG. 5 .
此外,本申请实施例还提供了一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行上述图1、图3以及图5所示的实施例提供的方法。In addition, an embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when run on a computer, cause the computer to execute the methods provided in the above-mentioned embodiments shown in FIG. 1 , FIG. 3 and FIG. 5 .
本申请实施例中提到的“第一图像”、“第一类样本”等名称中的“第一”只是用来做名字标识,并不代表顺序上的第一。该规则同样适用于“第二”等。The "first" in the names such as "first image" and "first type sample" mentioned in the embodiment of the present application is only used for name identification, and does not mean the first in order. The same rule applies to "second" etc.
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到上述实施例方法中的全部或部分步骤可借助软件加通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如只读存储器(英文:read-only memory,ROM)/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者诸如路由器等网络通信设备)执行本申请各个实施例或者实施例的某些部分所述的方法。From the above description of the implementation manners, it can be seen that those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus a general hardware platform. Based on this understanding, the technical solution of the present application can be embodied in the form of software products, and the computer software products can be stored in storage media, such as read-only memory (English: read-only memory, ROM)/RAM, disk, CDs, etc., include several instructions to make a computer device (which may be a personal computer, a server, or a network communication device such as a router) execute the methods described in various embodiments or some parts of the embodiments of this application.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例和设备实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的设备及系统实施例仅仅是示意性的,其中作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。Each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment and the device embodiment, because they are basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiment. The device and system embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.
以上所述仅是本申请的优选实施方式,并非用于限定本申请的保护范围。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above descriptions are only preferred implementations of the present application, and are not intended to limit the protection scope of the present application. It should be pointed out that those skilled in the art can make some improvements and modifications without departing from the present application, and these improvements and modifications should also be regarded as the protection scope of the present application.

Claims (10)

  1. 一种图像恢复方法,其特征在于,包括:An image restoration method, characterized in that, comprising:
    根据待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征,所述目标条件网络用于提取图像的退化特征;According to the first image to be restored and the target condition network, determine the first degradation feature of the first image, and the target condition network is used to extract the degradation feature of the image;
    根据所述第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络,所述目标超分网络用于恢复图像的质量;Adjust the parameters of the target super-resolution network according to the first degradation feature, determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
    根据所述第一图像和所述调整后的目标超分网络,获得所述第一图像恢复后的第二图像,所述第二图像的质量高于所述第一图像的质量。According to the first image and the adjusted target super-resolution network, a second image after restoration of the first image is obtained, and the quality of the second image is higher than that of the first image.
  2. 根据权利要求1所述的方法,其特征在于,所述目标超分网络和所述条件网络为分别利用样本数据库中的各类样本交替训练初始条件网络和初始超分网络获得的,其中,所述样本数据库为根据高质量的样本图像集合、退化模式和退化参数构建的,所述样本数据库中包括多类样本,每类样本中包括使用相同退化模式和退化参数对所述样本图像集合中的图像进行退化后所得的图像。The method according to claim 1, wherein the target super-resolution network and the conditional network are obtained by alternately training the initial condition network and the initial super-resolution network using various samples in the sample database, wherein the The sample database is constructed based on high-quality sample image collections, degradation modes and degradation parameters. The sample database includes multiple types of samples, and each type of sample includes the same degradation mode and degradation parameters for the sample image collection. The image obtained after the image is degraded.
  3. 根据权利要求2所述的方法,其特征在于,所述退化模式包括:分辨率、噪声、模糊或压缩中的至少一种。The method according to claim 2, wherein the degradation mode comprises: at least one of resolution, noise, blur or compression.
  4. 根据权利要求2所述的方法,其特征在于,所述样本数据库中包括第一类样本和第二类样本,所述分别利用所述样本数据库中的各类样本交替训练初始条件网络和初始超分网络,包括:The method according to claim 2, wherein the sample database includes samples of the first type and samples of the second type, and the initial condition network and the initial superstructure are alternately trained using various types of samples in the sample database. network, including:
    利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络;Using the first type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the intermediate condition network and the intermediate super-resolution network;
    基于所述中间条件网络和所述中间超分网络,更新所述初始条件网络和所述初始超分网络,更新后的所述初始条件网络为所述中间条件网络,更新后的所述初始超分网络为所述中间超分网络;Based on the intermediate condition network and the intermediate super-resolution network, update the initial condition network and the initial super-resolution network, the updated initial condition network is the intermediate condition network, and the updated initial super-resolution network The sub-network is the intermediate super-divided network;
    利用所述第二类样本,交替训练所述初始条件网络和所述初始超分网络,获得所述目标条件网络和所述目标超分网络。Using the second type of samples, alternately train the initial condition network and the initial super-resolution network to obtain the target condition network and the target super-resolution network.
  5. 根据权利要求4所述的方法,其特征在于,所述利用所述第一类样本,交替训练初始条件网络和初始超分网络,获得中间条件网络和中间超分网络,包括:The method according to claim 4, wherein said utilizing said first type of samples alternately trains an initial condition network and an initial super-resolution network to obtain an intermediate condition network and an intermediate super-resolution network, comprising:
    根据所述第一类样本中的多张第三图像和所述初始条件网络,确定第二退 化特征;Determining a second degradation feature based on a plurality of third images in the first type of samples and the initial condition network;
    根据所述第二退化特征调整所述初始超分网络的参数,确定调整后的初始超分网络;adjusting the parameters of the initial super-resolution network according to the second degradation feature, and determining the adjusted initial super-resolution network;
    根据所述第一类样本中的第四图像和所述调整后的初始超分网络,确定输出结果;Determine an output result according to the fourth image in the first type of samples and the adjusted initial super-resolution network;
    基于所述输出结果,训练所述初始条件网络,获得所述中间条件网络;Based on the output result, train the initial condition network to obtain the intermediate condition network;
    基于所述中间条件网络和所述第一类样本,训练所述初始超分网络,获得所述中间超分网络。Based on the intermediate condition network and the first type of samples, the initial super-resolution network is trained to obtain the intermediate super-resolution network.
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述目标条件网络包括卷积层和平均池化层,所述目标超分网络包括卷积层、多个残差块和上采样函数,每个残差块包括卷积层。The method according to any one of claims 1 to 5, wherein the target conditional network includes a convolutional layer and an average pooling layer, and the target super-resolution network includes a convolutional layer, a plurality of residual blocks and Upsampling function, each residual block includes a convolutional layer.
  7. 根据权利要求1至5任一项所述的方法,其特征在于,所述目标超分网络对应的初始超分网络的重建损失函数为:The method according to any one of claims 1 to 5, wherein the reconstruction loss function of the initial super-resolution network corresponding to the target super-resolution network is:
    Figure PCTCN2022089429-appb-100001
    Figure PCTCN2022089429-appb-100001
    所述目标条件网络对应的初始条件网络中的对比损失函数包括:The comparative loss function in the initial condition network corresponding to the target condition network includes:
    Figure PCTCN2022089429-appb-100002
    Figure PCTCN2022089429-appb-100002
    Figure PCTCN2022089429-appb-100003
    Figure PCTCN2022089429-appb-100003
    Figure PCTCN2022089429-appb-100004
    Figure PCTCN2022089429-appb-100004
    其中,所述Lres为重建损失函数,I LR为所述初始超分网络Fsr的输入图像,I HR为I LR退化前的图像,|||| 1用于计算1阶范数,p(τ)为采样函数,E用于计算期望,所述Linner为内部类损失函数,所述Lcross为交叉类损失函数,Lcon为对比损失函数,X i、X i’和X j为所述初始条件网络Fc的输入图像,X i和X i’属于相同类样本,X j与X i属于不同类样本,p x(τ)为针对样本图像集合X的采样函数,|||| 2用于计算1阶范数的平方。 Among them, the Lres is the reconstruction loss function, I LR is the input image of the initial super-resolution network Fsr, I HR is the image before I LR degradation, |||| 1 is used to calculate the first-order norm, p(τ ) is a sampling function, E is used to calculate expectations, the Linner is an internal class loss function, the Lcross is a cross class loss function, Lcon is a contrastive loss function, Xi , Xi ' and X j are the initial condition network The input image of Fc, Xi i and Xi ' belong to the same class of samples, X j and Xi i belong to different classes of samples, p x (τ) is the sampling function for the sample image set X, |||| 2 is used to calculate 1 The square of the order norm.
  8. 一种图像恢复装置,其特征在于,所述装置包括:An image restoration device, characterized in that the device comprises:
    第一确定单元,用于根据待恢复的第一图像和目标条件网络,确定所述第一图像的第一退化特征,所述目标条件网络用于提取图像的退化特征;A first determining unit, configured to determine a first degradation feature of the first image according to the first image to be restored and a target condition network, and the target condition network is used to extract the degradation feature of the image;
    第二确定单元,用于根据所述第一退化特征调整目标超分网络的参数,确定调整后的目标超分网络,所述目标超分网络用于恢复图像的质量;The second determination unit is configured to adjust the parameters of the target super-resolution network according to the first degradation feature, and determine the adjusted target super-resolution network, and the target super-resolution network is used to restore the quality of the image;
    获得单元,用于根据所述第一图像和所述调整后的目标超分网络,获得所述第一图像恢复后的第二图像,所述第二图像的质量高于所述第一图像的质量。An obtaining unit, configured to obtain a second image restored from the first image according to the first image and the adjusted target super-resolution network, the quality of the second image is higher than that of the first image quality.
  9. 一种电子设备,其特征在于,所述电子设备包括:处理器和存储器;An electronic device, characterized in that the electronic device includes: a processor and a memory;
    所述存储器,用于存储指令或计算机程序;said memory for storing instructions or computer programs;
    所述处理器,用于执行所述存储器中的所述指令或计算机程序,以使得所述电子设备执行权利要求1至7任一项所述的方法。The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the method according to any one of claims 1 to 7.
  10. 一种计算机可读存储介质,其特征在于,包括指令,当其在计算机上运行时,使得计算机执行以上权利要求1至7任一项所述的方法。A computer-readable storage medium is characterized by comprising instructions, which, when run on a computer, cause the computer to perform the method described in any one of claims 1 to 7 above.
PCT/CN2022/089429 2021-05-28 2022-04-27 Image restoration method and apparatus, and device WO2022247568A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110594614.7 2021-05-28
CN202110594614.7A CN113222855B (en) 2021-05-28 2021-05-28 Image recovery method, device and equipment

Publications (1)

Publication Number Publication Date
WO2022247568A1 true WO2022247568A1 (en) 2022-12-01

Family

ID=77099487

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/089429 WO2022247568A1 (en) 2021-05-28 2022-04-27 Image restoration method and apparatus, and device

Country Status (2)

Country Link
CN (1) CN113222855B (en)
WO (1) WO2022247568A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113222855B (en) * 2021-05-28 2023-07-11 北京有竹居网络技术有限公司 Image recovery method, device and equipment
CN114584675B (en) * 2022-05-06 2022-08-02 中国科学院深圳先进技术研究院 Self-adaptive video enhancement method and device
CN115115512B (en) * 2022-06-13 2023-10-03 荣耀终端有限公司 Training method and device for image superdivision network
CN115409716B (en) * 2022-11-01 2023-02-07 杭州网易智企科技有限公司 Video processing method, device, storage medium and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110047044A (en) * 2019-03-21 2019-07-23 深圳先进技术研究院 A kind of construction method of image processing model, device and terminal device
CN111028174A (en) * 2019-12-10 2020-04-17 深圳先进技术研究院 Multi-dimensional image restoration method and equipment based on residual connection
CN112750081A (en) * 2021-01-18 2021-05-04 北京小米松果电子有限公司 Image processing method, device and storage medium
CN113222855A (en) * 2021-05-28 2021-08-06 北京有竹居网络技术有限公司 Image recovery method, device and equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11521131B2 (en) * 2019-01-24 2022-12-06 Jumio Corporation Systems and methods for deep-learning based super-resolution using multiple degradations on-demand learning
CN109977774B (en) * 2019-02-25 2022-09-02 中国科学技术大学 Rapid target detection method based on adaptive convolution
CN110120011B (en) * 2019-05-07 2022-05-31 电子科技大学 Video super-resolution method based on convolutional neural network and mixed resolution
CN112419151B (en) * 2020-11-19 2023-07-21 北京有竹居网络技术有限公司 Image degradation processing method and device, storage medium and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110047044A (en) * 2019-03-21 2019-07-23 深圳先进技术研究院 A kind of construction method of image processing model, device and terminal device
CN111028174A (en) * 2019-12-10 2020-04-17 深圳先进技术研究院 Multi-dimensional image restoration method and equipment based on residual connection
CN112750081A (en) * 2021-01-18 2021-05-04 北京小米松果电子有限公司 Image processing method, device and storage medium
CN113222855A (en) * 2021-05-28 2021-08-06 北京有竹居网络技术有限公司 Image recovery method, device and equipment

Also Published As

Publication number Publication date
CN113222855B (en) 2023-07-11
CN113222855A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
WO2022247568A1 (en) Image restoration method and apparatus, and device
CN108022212B (en) High-resolution picture generation method, generation device and storage medium
US20210160556A1 (en) Method for enhancing resolution of streaming file
CN109886871B (en) Image super-resolution method based on channel attention mechanism and multi-layer feature fusion
US20220284547A1 (en) Super-resolution image reconstruction method based on deep convolutional sparse coding
EP3951702A1 (en) Method for training image processing model, image processing method, network device, and storage medium
EP3779891A1 (en) Method and device for training neural network model, and method and device for generating time-lapse photography video
CN107133923B (en) Fuzzy image non-blind deblurring method based on adaptive gradient sparse model
WO2021164269A1 (en) Attention mechanism-based disparity map acquisition method and apparatus
CN110958469A (en) Video processing method and device, electronic equipment and storage medium
CN113192147B (en) Method, system, storage medium, computer device and application for significance compression
CN112950480A (en) Super-resolution reconstruction method integrating multiple receptive fields and dense residual attention
WO2023138560A1 (en) Stylized image generation method and apparatus, electronic device, and storage medium
WO2023151277A1 (en) Data processing method and apparatus, device, and storage medium
Niu et al. Machine learning-based framework for saliency detection in distorted images
Xin et al. Video face super-resolution with motion-adaptive feedback cell
KR102130076B1 (en) Method for improving the resolution of streaming files based on the learning importance of feature areas
EP3893197A1 (en) Image analysis method and system
WO2023155305A1 (en) Image reconstruction method and apparatus, and electronic device and storage medium
KR20220070866A (en) Image enhancement method, device and program applied with deep learning technology
KR20220021495A (en) Method for improving the resolution of streaming files based on AI
Mustafa et al. A comparative study on the loss functions for image enhancement networks
Xu et al. Joint learning of super-resolution and perceptual image enhancement for single image
CN112581363A (en) Image super-resolution reconstruction method and device, electronic equipment and storage medium
CN111062886A (en) Super-resolution method, system, electronic product and medium for hotel pictures

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22810297

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE