Disclosure of Invention
In view of the above, an embodiment of the present invention is to provide a network training method, a device, an image processing method, and an electronic apparatus, so as to effectively improve the above-mentioned problems.
Embodiments of the present invention are implemented as follows:
in a first aspect, an embodiment of the present invention provides a network training method applied to a generated type countermeasure network, where the generated type countermeasure network includes: generating a network and an antagonizing network, the method comprising: acquiring a sample image of the current iterative training; inputting the sample image into the generation network to obtain a restored image; determining a self-learning parameter representing the difficulty level of the sample image according to the restored image and the reference image corresponding to the sample image; and training the countermeasure network and the generating network according to the self-step learning parameters and a self-step learning optimization mechanism when the next iteration is trained, wherein the countermeasure network is optimized firstly by using a single alternate iteration optimization method when the next iteration is trained, and then the generating network is optimized, and the self-step learning parameters are updated when each iteration is trained until the iteration is ended.
According to the embodiment of the application, the training mode is adjusted by adding the self-walking learning parameters into the training network, the model is enabled to learn the simple sample preferentially and autonomously in the initial training stage, and the priority of learning the complex sample is gradually increased along with the increase of training times, so that the disturbance of the complex sample (the image with low quality) to the generated network can be solved, the generalization capability and the autonomous learning capability of the model are enhanced, and the model has strong robustness.
With reference to a possible implementation manner of the first aspect embodiment, training the countermeasure network and the generating network according to the self-learning parameters and a self-learning optimization mechanism includes: training the countermeasure network and the generation network by the following formula;
wherein v is [0,1 ]]For the self-learning parameters x, < >>
The reference image and the restored image G, D are the generation network and the countermeasure network, x-p, respectively
r For the statistical distribution of the reference image, +.>
For the statistical distribution of the restored image, E (-) is desired,/->
Is a conditional loss function that adjusts the self-learning parameter.
With reference to a possible implementation manner of the first aspect embodiment, the optimization formula of the countermeasure network is as follows:
wherein (1)>
For the mixed distribution of the reference image and the restored image,>
and taking the value 0-1 as the weighted sum of the reference image and the restored image, wherein alpha is the parameter of the gradient regularization term.
With reference to a possible implementation manner of the first aspect embodiment, the optimization formula of the generating network is as follows:
wherein,,
c
1 、w
1 、h
1 the number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels, F (), at the feature level, respectively, of the restored image is the feature extraction network.
With reference to one possible implementation manner of the first aspect embodiment, determining a self-learning parameter characterizing a difficulty level of the sample image according to the restored image and a reference image corresponding to the sample image includes: determining a self-learning parameter characterizing the difficulty level of the sample image by the following formula;
wherein,,
f (v, t) represents the regularization term of the self-learning parameter in the t-th iteration, v= (v)
1 ,v
2 ,v
3 ,...,v
n-1 ,v
n ),
c
1 、w
1 、h
1 The number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels of the restored image at the feature level, F () is a feature extraction network; the self-step learning parameters are obtained according to an optimization theory:
wherein (1)>
t represents the t-th iteration, N represents the number of samples, N
max =n,
Representing the largest conditional loss function value in the t-1 th iteration, epoch being the largest number of iterations, +.>
And the optimal self-step learning parameter is the optimal self-step learning parameter of the ith sample image.
In a second aspect, an embodiment of the present invention further provides an image processing method, including: acquiring an image to be processed; inputting the image to be processed into a generated network trained by the network training method according to the embodiment of the first aspect and/or with any one of the possible implementation manners of the embodiment of the first aspect, so as to obtain a restored image.
In a third aspect, an embodiment of the present invention further provides a network training apparatus, applied to a generative countermeasure, where the generative countermeasure network includes: generating a network and an antagonizing network, the apparatus comprising: the system comprises a sample image acquisition module, a restored image acquisition module, a determination module and a training module; the sample image acquisition module is used for acquiring a sample image of the current iterative training; the recovery image acquisition module is used for inputting the sample image into the generation network to obtain a recovery image; the determining module is used for determining a self-learning parameter representing the difficulty level of the sample image according to the restored image and the reference image corresponding to the sample image; and the training module is used for training the countermeasure network and the generating network according to the self-walking learning parameters and the self-walking learning optimization mechanism during the next iterative training, wherein during the training, the countermeasure network is optimized firstly by utilizing a single alternate iterative optimization method, then the generating network is optimized, and the self-walking learning parameters are updated until the iteration is ended during each iterative training.
With reference to a possible implementation manner of the second aspect embodiment, the training module is specifically configured to train the countermeasure network and the generating network by the following formula;
wherein v is [0,1 ]]For the self-learning parameters x, < >>
The reference image and the restored image G, D are the generation network and the countermeasure network, x-p, respectively
r For the statistical distribution of the reference image, +.>
For the statistical distribution of the restored image, E (-) is desired,/->
Is a conditional loss function that adjusts the self-learning parameter.
With reference to a possible implementation manner of the second aspect embodiment, the optimization formula of the countermeasure network is as follows:
wherein (1)>
For the mixed distribution of the reference image and the restored image,>
and taking the value 0-1 as the weighted sum of the reference image and the restored image, wherein alpha is the parameter of the gradient regularization term.
With reference to a possible implementation manner of the second aspect embodiment, the optimization formula of the generated network is as follows:
wherein,,
c
1 、w
1 、h
1 the number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels, F (), at the feature level, respectively, of the restored image is the feature extraction network.
With reference to a possible implementation manner of the second aspect embodiment, the determining module is specifically configured to determine a self-learning parameter that characterizes a difficulty level of the sample image by using the following formula;
wherein,,
f (v, t) represents the regularization term of the self-learning parameter in the t-th iteration, v= (v)
1 ,v
2 ,v
3 ,...,v
n-1 ,v
n ),
c
1 、w
1 、h
1 The number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels of the restored image at the feature level, F () is a feature extraction network; the self-step learning parameters are obtained according to an optimization theory:
wherein (1)>
t represents the t-th iteration, N represents the number of samples, N
max =n,
Representing the largest conditional loss function value in the t-1 th iteration, epoch being the largest number of iterations, +.>
And the optimal self-step learning parameter is the optimal self-step learning parameter of the ith sample image.
In a fourth aspect, an embodiment of the present invention further provides an electronic device, including: the device comprises a memory and a processor, wherein the memory is connected with the processor; the memory is used for storing programs; the processor is configured to invoke the program stored in the memory to perform the embodiments of the first aspect and/or the methods provided in connection with any possible implementation of the embodiments of the first aspect; or to perform the method provided by the embodiments of the second aspect described above.
In a fifth aspect, the present embodiments further provide a storage medium comprising a computer program which, when executed by a computer, performs the above-described embodiments of the first aspect and/or the method provided in connection with any one of the possible implementations of the embodiments of the first aspect; or to perform the method provided by the embodiments of the second aspect described above.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present invention, it should be noted that the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance. Furthermore, the term "and/or" in this application is merely an association relation describing an association object, and indicates that three relations may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone.
First embodiment
As shown in fig. 1, fig. 1 shows a block diagram of an electronic device 100 according to an embodiment of the present invention. The electronic device 100 includes: memory 120, memory controller 130, and processor 140. The components and structures of the electronic device 100 shown in fig. 1 are exemplary only and not limiting, as the electronic device 100 may have other components and structures as desired.
The memory 120, the memory controller 130, and the processor 140 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The Memory 120 may be, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc. The memory 120 is configured to store a program, that is, a program required for executing the image processing method or the network training method according to the present embodiment, and the processor 140 executes the program after receiving an execution instruction, and the method executed by the electronic device 100 defined by the flow disclosed in any embodiment of the present invention may be applied to the processor 140 or implemented by the processor 140. After the processor 140 receives the execution instruction, the processor 140 may execute the image processing method or the flow of the network training method after calling the program stored in the memory 120 through the bus.
The processor 140 may be an integrated circuit chip with signal processing capabilities. The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in hardware, in a decoded processor, or in a combination of hardware and software modules in a decoded processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art.
In this embodiment of the present invention, the electronic device 100 may be, but is not limited to, a network server, a database server, a cloud server, etc.
Referring to fig. 2, an image processing method applied to the electronic device 100 according to an embodiment of the present invention is described below with reference to fig. 2.
Step S101: and acquiring an image to be processed.
A degraded image, such as a blurred image, to be processed is acquired. The degraded image may be, for example, an image of an image degradation phenomenon caused by a relative motion between the object and the camera during photographing, and such an image is generally represented as an image texture becoming blurred, and in severe cases, may cause loss of image information. Or such an image that the photographed image is unclear because the photographed light is dark. In addition, the degraded image may be a simulated blurred image synthesized by a machine, in addition to a true blurred image captured by a camera.
Step S102: and inputting the image to be processed into a generation network trained in advance to obtain a restored image.
The degraded image is input into a generating network trained by the network training method, and the enhanced restored image can be obtained under the action of the generating network.
The generating network may be a generating network commonly used at present, such as a residual network, a Skip network, a Unet network, etc., which is not limited in the present application. The generalization capability and the learning capability of the generating network can be improved by training the generating network in the following way, so that the generating network has stronger robustness, and further, a restored image with good enhancement effect can be obtained.
Aiming at the problems of single mode, weak generalization capability and the like of the traditional image enhancement model, the embodiment of the invention provides a sample which adopts a self-learning optimization mechanism to enhance the learning and generalization capability of a generating network, and introduces self-learning parameters into the generating network and a judging network in model training so as to lead the self-learning parameters to learn the sample to be trained independently. Fig. 3 is a schematic diagram of training a generating network by using a self-learning optimization mechanism according to an embodiment of the present invention.
Among them, self-learning (self-past learning) is a learning methodology that, in combination with the idea of cognitive science, carefully adaptively prioritizes learning simple, reliable examples, and then gradually transitions to learning for difficult examples. For example, children typically begin learning simple courses from a first grade and then gradually transition from a second grade, a third grade, etc. to difficult courses; for another example, in the image deblurring process, a simple blur kernel is learned first, and then a complex blur kernel (e.g., image blur due to rotation, etc.) is learned.
In training the optimized generation network, an countermeasure network, i.e., a discrimination network, needs to be connected in series behind the generation network, as shown in fig. 3. The network and the countermeasure network are generated as two players, the purpose of the network is to generate vivid images as much as possible, so that the countermeasure network cannot identify true or false, and the purpose of the countermeasure network is to distinguish whether the input image is from a true sample set or a false sample set as much as possible, wherein the closer the output value is to 1, the greater the possibility that the input image is from the true sample set, the closer the output value is to 0, the greater the possibility that the input image is from the false sample set, and the two can be reversed. In the embodiment of the present application, parameters of the countermeasure network are shown in table 1.
Table 1 (challenge network parameter settings)
| #
|
Layer(s)
|
Parameter dimension
|
Step size
|
| 1
|
Convolutional layer
|
32x3x5x5
|
2
|
| 2
|
Convolutional layer
|
64x32x5x5
|
1
|
| 3
|
Convolutional layer
|
64x64x5x5
|
2
|
| 4
|
Convolutional layer
|
128x64x5x5
|
1
|
| 5
|
Convolutional layer
|
128x128x5x5
|
4
|
| 6
|
Convolutional layer
|
256x128x5x5
|
1
|
| 7
|
Convolutional layer
|
256x256x5x5
|
4
|
| 8
|
Convolutional layer
|
512x256x5x5
|
1
|
| 9
|
Convolutional layer
|
512x512x4x4
|
4
|
| 10
|
Full connection layer
|
512x1x1x1
|
- |
The parameter dimensions in table 1, such as 32x3x5x5, 128x128x5x5, etc., have the following meanings, the first digits, such as 32, 64, 128, etc., represent the number of channels of the current layer feature, the second digits, such as 3, 32, 64, etc., represent the number of channels of the previous layer feature, and the last two digits, such as 5x5, 4x4, and 1x1, represent the size of the convolution kernel.
The training generating type countermeasure network, that is, the training generating network and the countermeasure network, may be referred to as a network training method shown in fig. 4. The steps involved will be described below in connection with fig. 4.
Step S201: and acquiring a sample image of the current iteration training.
And acquiring a sample image when the current iterative training generates the countermeasure network. The sample image can be a real blurred image shot by a camera or a simulated blurred image synthesized by a machine. The sample image obtained is the sample image at the time of the t-th substitution. Wherein, t is a positive integer, such as 1, 2, 3 and … ….
Step S202: and inputting the sample image into the generation network to obtain a restored image.
After the sample image of the current iterative training is obtained, for example, after the sample image of t times of substitution is obtained, the sample image is input into a generating network to obtain a restored image, namely, the sample image is input into the generating network, and the output characteristic of the generating network is the restored image.
Step S203: and determining a self-learning parameter representing the difficulty level of the sample image according to the restored image and the reference image corresponding to the sample image.
After a restored image corresponding to the sample image is obtained, determining a self-learning parameter v representing the difficulty level of the sample image according to a reference image corresponding to the sample image and the restored image during the current iterative training.
As an alternative embodiment, the magnitude of the self-learning parameter characterizing the difficulty level of the sample image may be given according to the complexity level of the restored image and the reference image corresponding to the sample image. The size of the self-learning parameter can be determined according to whether the scene in the reference image corresponding to the restored image and the sample image is single, whether the texture in the image is large or small, and the like. In this embodiment, the size of the self-learning parameter may be set in advance, and when in use, the self-learning parameter may be matched with the corresponding self-learning parameter.
As a further alternative embodiment, a self-learning parameter characterizing the difficulty level of the sample image may be determined by the following formula; wherein, the formula is as follows:
the formula means: to ask for the cause->
The value of v at the minimum is reached, i.e. a v value is determined such that +.>
And reaching the minimum value, wherein the formula is an optimization formula for self-learning parameters. Wherein (1)>
q(t)>1, f (v, t) represents the regularization term of the self-learning parameter in the t-th iteration, v is a vector, v= (v)
1 ,v
2 ,v
3 ,...,v
n-1 ,v
n ),v
i As a self-learning parameter of the ith sample image,
c
1 、w
1 、h
1 the number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels, F (), at the feature level, respectively, of the restored image is a feature extraction network, such as the Vgg19 network, is employed to extract features.
The self-step learning parameter v can be obtained according to the optimization theory as follows:
the formula is a solution formula for the self-learning parameters.
Wherein,,
t represents the t-th iteration, N represents the number of samples, N
max =n,
Representing the largest conditional loss function value in the t-1 th iteration, epoch is the largest number of iterations, e.g. 300 +.>
Optimal self-walking learning parameters for the ith sample image, wherein the optimal self-walking learning parameters
I.e. the self-learning parameter v, where i has a value from 1 to n.
It should be noted that, the difficulty level of the sample image is different, and the corresponding self-learning parameter v is also different. That is, in the training process, each sample image has a parameter which is learned by self-step; after initializing the self-learning parameters, the network can gradually adjust the value of the self-learning parameter v according to the self-learning capability so as to lead the self-learning parameter v to learn the sample to be trained.
Wherein the value of the self-learning parameter v is 0-1; the larger the value of the self-learning parameter v, the higher the difficulty level of characterizing the sample image.
Step S204: and training the countermeasure network and the generating network according to the self-learning parameters and a self-learning optimization mechanism when training is performed in the next iteration.
After obtaining the self-learning parameters representing the difficulty level of the sample image of the current iterative training, updating the previous self-learning parameters so as to train the countermeasure network and the generating network according to the self-learning parameters and a self-learning optimization mechanism when the next iterative training is performed. During training, the countermeasure network is optimized firstly by using a single alternate iterative optimization method, then the generating network is optimized, and the self-learning parameters are updated when each time of iterative training is performed until the iteration is finished, wherein the iteration times can be set as required, for example, 300 times.
Wherein the countermeasure network and the generation network can be trained by the following formula;
wherein v is [0,1 ]]For the self-learning parameters x, < >>
Representing the reference image and the restored image, respectively, G, D being the generating network and the countermeasure network, respectively, x-p
r For the statistical distribution of the reference image, +.>
For the statistical distribution of the restored image, E (-) is desired,/->
Is a conditional loss function that adjusts the self-learning parameter. Wherein,,
the formula of the optimization mechanism is learned for a self-step.
During training, the restored image (false sample set) and the reference image (true sample set) output by the generating network (which can be the generating network commonly used at present, such as a residual network, a Skip network, a Unet network and the like) are respectively input into the countermeasure network, and the countermeasure network and the generating network are trained by using a single alternate iterative optimization method until the iteration is finished. And during optimization, optimizing the countermeasure network first, and then optimizing the generation network. The method for optimizing the countermeasure network is characterized in that the generation network is temporarily not considered when the countermeasure network is optimized, and the countermeasure network is temporarily not considered when the generation network is optimized.
In the embodiment of the application, in order to enhance the learning and generalization capability of the generated network, a self-walking learning parameter is added into a conditional loss function to adjust a training mode, a model is allowed to learn a simple sample autonomously preferentially in the initial stage of training, and the priority of learning a complex sample is gradually increased along with the increase of training times.
Wherein, the optimization formula of the countermeasure network is as follows:
wherein (1)>
For the mixed distribution of the reference image and the restored image,>
and taking the value 0-1 as the weighted sum of the reference image and the restored image, wherein alpha is the parameter of the gradient regularization term.
Wherein, the optimization formula of the countermeasure network means: the first term + the second term + the third term is minimized. Wherein the first term is:
the second item is:
The third item is->
The term is a gradient canonical term.
The optimization formula for generating the network is as follows:
wherein, generating the optimized formula expression of the network means: the first term + the second term is minimized. Wherein the first term is:
The second item is:
Wherein,,
c
1 、w
1 、h
1 the number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels, F (), at the feature level, respectively, of the restored image is the feature extraction network. The model is constrained at two levels of pixels and features by using a conditional loss function, and noise generation is restrained by the constraint at the pixel level while the noise is subjected to Gaussian distribution by the constraint at the feature level. Wherein (1)>
For pixel level constraint, +.>
Is a feature level constraint.
For ease of understanding, the following will exemplify, for example, initializing the values of parameters in the model when the generating network and the countermeasure network are trained by the training method, where the values of the self-learning parameters are initialized default values. And in the first iteration, inputting the 1 st sample image into a generating network with the self-learning parameter as a default value to obtain a first recovery image, determining the self-learning parameter representing the difficulty degree of the 1 st sample image according to the first recovery image and a reference image corresponding to the 1 st sample image, obtaining the self-learning parameter of a first value of the current iteration according to the evaluation formula of the self-learning parameter, and then replacing the previous self-learning parameter by the self-learning parameter of the first value, namely replacing the default value, so that the generating network and the countermeasure network are trained based on the self-learning parameter of the first value in the next iteration training. In the second iteration, the 2 nd sample image is input into the self-learning parameter generation network with the first value to obtain a second recovery image, for example, the self-learning parameter representing the difficulty level of the 2 nd sample image is determined according to the second recovery image and the reference image corresponding to the 2 nd sample image, the self-learning parameter of the second value of the current iteration can be obtained according to the evaluation formula of the self-learning parameter, and then the self-learning parameter of the second value is utilized to replace the previous self-learning parameter, namely the self-learning parameter of the first value is replaced, so that the generation network and the countermeasure network are trained based on the self-learning parameter of the second value in the next iteration training. Training the generating network and the countermeasure network based on the self-learning parameters determined in the second iteration in the third iteration; and training the generating network and the countermeasure network based on the self-learning parameters determined by the third iteration in the fourth iteration, and so on until the iteration is ended.
The training mode is adjusted by adding self-walking learning parameters into the training network, the model is enabled to learn simple samples autonomously in priority in the initial stage of training, and the priority of learning complex samples is gradually increased along with the increase of training times. Therefore, the disturbance of complex samples (images with low quality) to the generated network can be solved, the generalization capability of the model is enhanced, and the model has strong robustness. The training method shown in the embodiment of the invention is used for verification under various generation networks, the test result is shown in the condition of training by using the same model, and the self-learning optimization mechanism in the embodiment of the invention can averagely improve the peak signal-to-noise ratio (Peak Signal to Noise Ratio, PSNR) of the image by 0.5dB on the basis of the original model training.
The generating network and the judging network are trained by the method, so that the finally output graph of the generating network can enable the countermeasure network, namely the judging network, to be unrecognizable, and the final output value is about 0.5. That is, when the output value of the countermeasure network is about 0.5, the generation network is shown to be optimal, that is, the generation network is trained, and the trained generation network can be used for recovering the blurred image.
Second embodiment
The embodiment of the application also provides a network training device 200, as shown in fig. 4. The network training apparatus 200 includes: a sample image acquisition module 210, a restored image acquisition module 220, a determination module 230, a training module 240.
The sample image obtaining module 210 is configured to obtain a sample image of the current iterative training.
The restored image obtaining module 220 is configured to input the sample image into the generating network, and obtain a restored image.
The determining module 230 is configured to determine a self-learning parameter that characterizes the difficulty level of the sample image according to the restored image and a reference image corresponding to the sample image. The determining module 230 is specifically configured to determine a self-learning parameter that characterizes the difficulty level of the sample image according to the following formula;
wherein (1)>
f (v, t) represents the regularization term of the self-learning parameter in the t-th iteration, v= (v)
1 ,v
2 ,v
3 ,...,v
n-1 ,v
n ),
c
1 、w
1 、h
1 The number, width and height of channels of the restored image at pixel level, c
2 、w
2 、h
2 The number, width and height of channels of the restored image at the feature level, F () is a feature extraction network; the self-step learning parameters are obtained according to an optimization theory:
Wherein,,
t represents the t-th iteration, N represents the number of samples, N
max =n,
Representing the largest conditional loss function value in the t-1 th iteration, epoch is the largest number of iterations,
and the optimal self-step learning parameter is the optimal self-step learning parameter of the ith sample image.
The
training module 240 is configured to train the countermeasure network and the generating network according to the self-learning parameters and the self-learning optimization mechanism when training is performed in the next iteration, wherein during training, the countermeasure network is optimized first and then the generating network is optimized by using an independent alternate iteration optimization method, and the self-learning parameters are updated until the iteration is completed when training is performed in each iteration. Wherein the
training module 240 is specifically configured to train the countermeasure network and the generating network through the following formula;
wherein v is [0,1 ]]For the self-learning parameters x, < >>
The reference image and the restored image G, D are the generation network and the countermeasure network, x-p, respectively
r For the statistical distribution of the reference image, +.>
For statistical distribution of the restored image, E (deg.) is desired,
is a conditional loss function that adjusts the self-learning parameter.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
The network training device 200 according to the embodiment of the present invention has the same implementation principle and technical effects as those of the foregoing method embodiment, and for brevity, reference may be made to the corresponding content of the foregoing method embodiment where the device embodiment is not mentioned.
Third embodiment
The present application also provides a computer-readable storage medium, on which a computer program is stored, which when executed by a computer performs the steps of the method described in the first embodiment. The specific implementation may refer to a method embodiment, which is not described herein.
In particular, the storage medium can be a general-purpose storage medium, such as a removable disk, a hard disk, or the like, and when the program code on the storage medium is executed, the image processing method or the network training method shown in the above embodiment can be executed.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present invention may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a notebook computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes. It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.