CN111402159B - Image processing method, image processing device, electronic equipment and computer readable medium - Google Patents

Image processing method, image processing device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN111402159B
CN111402159B CN202010177472.XA CN202010177472A CN111402159B CN 111402159 B CN111402159 B CN 111402159B CN 202010177472 A CN202010177472 A CN 202010177472A CN 111402159 B CN111402159 B CN 111402159B
Authority
CN
China
Prior art keywords
image
loss function
network
training
processed
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202010177472.XA
Other languages
Chinese (zh)
Other versions
CN111402159A (en
Inventor
李华夏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Douyin Vision Beijing Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010177472.XA priority Critical patent/CN111402159B/en
Publication of CN111402159A publication Critical patent/CN111402159A/en
Application granted granted Critical
Publication of CN111402159B publication Critical patent/CN111402159B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/73Deblurring; Sharpening
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the disclosure provides an image processing method, an image processing device, an electronic device and a computer readable medium, and the method comprises the following steps: acquiring an image to be processed; performing at least one image processing on an image to be processed through an image generation network to obtain a processed image, wherein the definition of the processed image is higher than that of the image to be processed; the image generation network is a generation network in the trained generation type countermeasure network. In the embodiment of the disclosure, when the sharpness of the image to be processed is improved, the image to be processed may be processed at least once based on the image generation network, and because the image generation network is a generation network in a trained generation countermeasure network, when the sharpness of various images to be processed is improved (i.e., deblurring processing), a better deblurring effect may be achieved, and some singular points may not be generated in the deblurring process, thereby improving user experience.

Description

Image processing method, image processing device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method and apparatus, an electronic device, and a computer-readable medium.
Background
With the rapid development of computer technology and communication technology, the use of intelligent terminals is widely popularized, and more application programs are developed to facilitate and enrich the work and life of people, for example, the definition of an image is improved (i.e., the image is deblurred), so that an image with higher definition is obtained.
In the prior art, the conventional image deblurring processing only has a good deblurring effect on blur generated by motion in an image, but has a poor deblurring effect on blur generated by other reasons, and in addition, some singular points may be generated in the deblurring process to cause the poor deblurring effect, so that the user experience is poor.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, an embodiment of the present disclosure provides an image processing method, including:
acquiring an image to be processed;
performing at least one image processing on the image to be processed through an image generation network to obtain a processed image, wherein the definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in the trained generation type countermeasure network.
In a second aspect, an embodiment of the present disclosure provides an image processing apparatus, including:
the image acquisition module is used for acquiring an image to be processed;
the image processing module is used for carrying out at least one-time image processing on the image to be processed through an image generation network to obtain a processed image, and the definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in the trained generation type countermeasure network.
In a third aspect, the present disclosure provides an electronic device comprising a processor and a memory;
a memory for storing computer operating instructions;
a processor for performing the method as shown in any of the first aspect of the embodiments of the present disclosure by invoking computer operational instructions.
In a fourth aspect, the present disclosure provides a computer readable medium having stored thereon at least one instruction, at least one program, set of codes or set of instructions, which is loaded and executed by a processor to implement a method as shown in any one of the first aspect of embodiments of the present disclosure.
The technical scheme provided by the embodiment of the disclosure has the following beneficial effects:
in the embodiment of the disclosure, when the sharpness of the image to be processed is improved, the image to be processed may be processed at least once based on the image generation network, and because the image generation network is a generation network in a trained generation countermeasure network, when the sharpness of various images to be processed is improved (i.e., deblurring processing), a better deblurring effect may be achieved, and some singular points may not be generated in the deblurring process, thereby improving user experience.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart of an image processing method according to an embodiment of the disclosure;
FIG. 2A is a schematic view of an image according to an embodiment of the disclosure;
FIG. 2B is a schematic view of another image according to an embodiment of the disclosure;
FIG. 3 is a schematic flow chart illustrating a method for training a generative confrontation network according to an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart illustrating a method for training a generative confrontation network according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an initial generative countermeasure network in an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a structure of a loss function according to an embodiment of the present disclosure;
FIG. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the disclosure;
fig. 8 is a schematic structural diagram of an electronic device in an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the devices, modules or units to be determined as different devices, modules or units, and are not used for limiting the sequence or interdependence relationship of the functions executed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
An embodiment of the present disclosure provides an image processing method, as shown in fig. 1, which may include:
step S110, an image to be processed is acquired.
The image to be processed refers to an image needing to be improved in definition, namely an image needing to be deblurred. In the embodiment of the present disclosure, the image to be processed may include a certain object, such as a human face, a human body, a building, a vehicle, a landscape, and the like, which is not limited by the embodiment of the present disclosure. In addition, the image to be processed may be an image of any style, such as a color photo style image, a black and white photo style image, a color oil painting style image, and the like, which is not limited in this disclosure.
Step S120, carrying out at least one image processing on the image to be processed through the image generation network to obtain a processed image, wherein the definition of the processed image is higher than that of the image to be processed; the image generation network is a generation network in the trained generation type countermeasure network.
In practical application, when the image with the image definition being improved is needed, the image to be processed can be correspondingly processed based on the image generation network, and then the image with the image definition being improved can be obtained. For example, after an image to be processed (see fig. 2A) with H × W (i.e., H pixels × W pixels) is processed by the image generation network, an image with HxW and higher definition than the image to be processed (see fig. 2B) can be obtained.
Further, if a higher-definition image is desired, multiple (including two) image processes may be performed through the image generation network to obtain the higher-definition image, where, when multiple image processes are performed, an input image of the image generation network at a next image process is an output image of a previous image process. The image generation network is a generator g (generator) in a trained Generative Adaptive Network (GAN).
In the embodiment of the disclosure, when the sharpness of the image to be processed is improved, the image to be processed may be processed at least once based on the image generation network, and because the image generation network is a generation network in a trained generation countermeasure network, when the sharpness of various images to be processed is improved (i.e., deblurring processing), a better deblurring effect may be achieved, and some singular points may not be generated in the deblurring process, thereby improving user experience.
In an optional embodiment of the present disclosure, the generative confrontation network comprises a generative network and a discriminative network;
as shown in fig. 3, the generative confrontation network is trained by the following ways:
step S301, a training sample set is obtained, wherein the training sample set comprises sample image pairs, each sample image pair comprises a first image and a second image, the original image contents of the first image and the second image are the same, and the definition of the first image is smaller than that of the second image;
step S302, training the initial generative confrontation network based on the training sample set until the corresponding loss function meets the set condition.
In practical applications, the main structure of the generative countermeasure network GAN includes a generator g (generator) and a discriminator d (discriminator).
The training sample set refers to sample data for training the generative confrontation network, and each sample image pair comprises a first image and a second image with the same original image content. Wherein the sharpness of the first image in each sample image pair is less than the sharpness of the second image. That is, for the second image in each sample image pair, there may be sharpness changes from the first image in that sample image pair.
Further, the initial generative countermeasure network may be trained based on the training sample set until the corresponding loss function satisfies the set condition. When the corresponding loss function meets the set condition, the generated countermeasure network obtained at the moment has a good effect of improving the image definition. For convenience of description, the first image will be referred to as a blurred image, and the second image will be referred to as a sharp image corresponding to the blurred image.
In alternative embodiments of the present disclosure, the first image may be obtained by:
acquiring a second image;
and carrying out blurring processing on the second image based on a preset image blurring processing method to obtain a first image.
The specific type of the second image is not limited in the embodiments of the present disclosure, and may be a single image captured by an image capturing device, a video frame image in a video, or the like.
In practical application, when images in each sample image pair are obtained, only each sharp image may be obtained, and then each sharp image is blurred based on a preset image blurring method, so that a blurred image (i.e., a first image) corresponding to each sharp image and having a sharpness smaller than that of the sharp image is obtained. The image blurring processing method may be configured in advance, and the embodiment of the present disclosure is not limited. For example, a sharp image may be blurred by adding a mosaic.
In the embodiment of the disclosure, when the image in the sample image pair is obtained, the corresponding blurred image can be directly obtained based on the clear image, and the corresponding blurred image does not need to be separately obtained, so that resources can be effectively saved, and the processing efficiency is improved.
As shown in fig. 4, in an alternative embodiment of the present disclosure, training the initial generative confrontation network based on the training sample set may include:
step S401, inputting a first image in each sample image pair into a generation network to obtain a generation image corresponding to the first image;
step S402, inputting the second image and the corresponding generated image into a discrimination network to obtain a first discrimination result corresponding to the generated image and a second discrimination result corresponding to the second image;
step S403 is to calculate a value of the loss function based on the generated image, the second image, the first determination result, and the second determination result, and train the generative countermeasure network based on the value of the loss function.
In practical applications, as shown in fig. 5, the initial generative confrontation network may include a generation network and a discrimination network, and the generation network included therein is used as a generator G for performing sharpness enhancement processing on the first image (i.e., blurred image) in each sample image pair and outputting a generated image; the discrimination network in the initial generative confrontation network serves as a discriminator D for discriminating the second image (i.e., sharp image) in the training sample set and the authenticity of the generated image (i.e., discrimination result in fig. 5), i.e., whether the second image is sharp (Real) or blurred (Fake) (i.e., second discrimination result in fig. 5), and whether the generated image is sharp or blurred (i.e., first discrimination result in fig. 5), further, calculating the value of the loss function based on the generated image, the second image, the first discrimination result, and the second discrimination result, and then training the generative confrontation network based on the value of the loss function.
After the first image is input to the generation network, the generation network may extract features of the first image and generate a generated image corresponding to the first image based on the extracted features. For example, the generation network may perform the up-sampling process for a set number of times and the down-sampling process for a set number of times on the first image to obtain a generated image corresponding to the first image.
Further, a second discrimination result for characterizing the authenticity (i.e., clear or blurred) of the second image and a first discrimination result for characterizing the authenticity (i.e., clear or blurred) of the generated image may be determined based on the discrimination network.
In an example, training the initial generative confrontation network based on the training sample set may specifically include:
initializing the generation network parameters of the initial generation type countermeasure network and the network parameters of a judgment network;
training an initializing initial generative confrontation network based on m sample image pairs, wherein the m sample image pairs may comprise a first set of images { a }1,a2,…,amAnd a second set of images b1,b2,…,bmIn which aiAnd biFor a sample image pair, e.g. a1And b1Namely a sample image pair; further, the generated images may be generated based on m generated images obtained from the generation network
Figure BDA0002411294280000071
Further, training a discrimination network to distinguish a real sample (clear image) and a generated sample (generated image) as accurately as possible; training the generation network to reduce the difference between the generated sample (generated image) and the real sample (sharp image) as much as possible also means that the discrimination network cannot discriminate whether the image is the sharp image in the sample image or the image generated by the generation network as much as possible. That is, the two networks respectively improve the generation capability and the discrimination capability in the process of the countermeasure training. After multiple update iterations, the final ideal case is to discriminate whether the network cannot discriminate whether the sample is a generated sample or a real sample.
In the embodiment of the disclosure, because the generation capability of the generation network reaches an ideal state through the countermeasure training, the trained generation network is determined as the image generation network, and a good effect of improving the image definition can be achieved.
In an alternative embodiment of the present disclosure, as shown in fig. 6, the loss function may include a pixel loss function, a first discrimination result loss function, a second discrimination result loss function, and an image generation loss function, wherein,
the value of the pixel loss function is determined based on corresponding pixels in the second image and the corresponding generated image in each sample image pair; the value of the first discrimination loss function is determined based on the first discrimination corresponding to the generated image in each sample image pair; the value of the second discrimination loss function is determined based on a second discrimination result corresponding to the second image in each sample image pair; the value of the image generation loss function is determined based on the second image and the corresponding generated image in each sample image pair.
In the embodiment of the present disclosure, since the decision network needs to determine all m second images as true samples (that is, true samples, where the true probability is 1), but in the actual training process, the probability that each second image is determined as true by the decision network may not be 1, at this time, a countermeasure loss function may be determined based on the determination of the true and false probabilities of the second images, which is defined as a second decision result loss function corresponding to the second image in the embodiment of the present disclosure, and for convenience of description, the second decision result loss function corresponding to the second image is hereinafter referred to as "loss 1" for short.
Further, since the discrimination network needs to discriminate all m generated images as false samples (i.e. the generated samples have a true probability of 0), in the actual training process, the probability that each generated image is discriminated as true by the discrimination network may not be 0. Another countermeasure loss function, which is defined as a first discrimination result loss function corresponding to the generated image in the embodiment of the present disclosure, may be determined at this time based on a determination of a true or false probability of the generated image, and for convenience of description, the first discrimination result loss function corresponding to the generated image will be simply referred to as loss2 hereinafter.
Accordingly, the difference between the generated sample (generated image) and the real sample (clear image) needs to be reduced as much as possible, that is, the generated network determines that the judgment of the network is wrong as much as possible, and all the m generated images are judged as the real sample. The pixel loss function loss3 and the image generation loss function loss4 may be determined at this time based on the generated image and the second image (sharp image) that are generated.
The pixel loss function and the generation loss characterization function are image difference degrees between the generated image and the clear image, the pixel loss function loss3 is characterized by the difference degree at the pixel level, and the image generation loss function loss4 is characterized by the difference degree at the image level. In practical applications, the specific functional form of each loss function is not limited in the present disclosure.
It will be clear to a person skilled in the art that the image sizes of the first image, the second image and the corresponding generated image in each set of training samples are the same, e.g. b1A1 and
Figure BDA0002411294280000081
are the same. But there may be a difference between the second image (sharp image) in each sample image pair and the corresponding generated imageThe corresponding second and generated images may be aimed at, e.g. for b1And
Figure BDA0002411294280000082
comparing the same pixels one by one, determining the difference value of each pixel, and determining the value of the pixel loss function between the second image and the generated image according to the difference value of each pixel. In one possible implementation, the difference values of each pixel are summed to obtain a value of a pixel loss function between the second image and the generated image.
In the embodiment of the present disclosure, calculating a value of a loss function based on the generated image, the second image, the first determination result, and the second determination result includes:
determining the weight of each function;
and performing weighted fusion on the values of the functions based on the weight of the functions to obtain the value of the loss function.
In practical application, considering that the degree of contribution of each sample image to the corresponding pixel loss, first discrimination result loss, second discrimination result loss and image generation loss to network optimization is different, in the embodiment of the present disclosure, a weight corresponding to each loss may be set to represent the importance degree of each loss.
In practical applications, different image sample pairs may use the same weight for the pixel loss function, the value of the first discrimination result loss function, the value of the second discrimination result loss function, and the value of the image generation loss function.
A person skilled in the art may adjust weights respectively corresponding to the pixel loss function, the first discrimination result loss function, the second discrimination result loss function, and the image generation loss function corresponding to the sample image according to an actual situation, which is not limited herein in the embodiment of the present disclosure.
Hereinafter, for convenience of description, the weights corresponding to the pixel loss function, the first discrimination result loss function, the second discrimination result loss function, and the image generation loss function corresponding to each sample image pair are abbreviated as w1, w2, w3, and w4, respectively.
Then for the disclosed embodiments, for each sample image pair, the total Loss is:
Loss=w1×loss3+w2×loss2+w3×loss1+w4×L2_loss4
and then in the training process, adjusting network parameters of the generation network and the judgment network according to the Loss function Loss corresponding to each sample image pair, optimizing the generation type confrontation network, and after adjustment aiming at a plurality of groups of training samples, converging the Loss so as to finish the training of the generation type confrontation network.
In the embodiment of the present disclosure, the generative confrontation network may be optimized according to the total loss function corresponding to each sample image to obtain an optimal training effect, and at this time, when the sharpness of the image is processed by using the generative network in the trained generative confrontation network, a processing effect with the clearest degree and the highest sharpening degree may be obtained.
Based on the same principle as the method shown in fig. 1, an embodiment of the present disclosure also provides an image processing apparatus 30, as shown in fig. 7, the image processing apparatus 30 may include an image acquisition module 310 and an image processing module 320, where:
an image obtaining module 310, configured to obtain an image to be processed;
the image processing module 320 is configured to perform at least one image processing on an image to be processed through an image generation network to obtain a processed image, where a definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in the trained generation type countermeasure network.
In the embodiment of the disclosure, the generative confrontation network comprises a generative network and a discriminant network; the device comprises a training module, a generation type confrontation network and a generation type confrontation network, wherein the training module is used for training in the following way:
acquiring a training sample set, wherein the training sample set comprises sample image pairs, each sample image pair comprises a first image and a second image, the original image contents of the first image and the second image are the same, and the definition of the first image is smaller than that of the second image;
and training the initial generative confrontation network based on the training sample set until the corresponding loss function meets the set condition.
In the embodiment of the present disclosure, the first image is obtained by:
acquiring a second image;
and carrying out blurring processing on the second image based on a preset image blurring processing method to obtain a first image.
In the embodiment of the present disclosure, when the training module trains the initial generative confrontation network based on the training sample set, the training module is specifically configured to:
inputting a first image in each sample image pair into a generation network to obtain a generation image corresponding to the first image;
inputting the second image and the corresponding generated image into a discrimination network to obtain a first discrimination result corresponding to the generated image and a second discrimination result corresponding to the second image;
and calculating the value of the loss function based on the generated image, the second image, the first judgment result and the second judgment result, and training the generative countermeasure network based on the value of the loss function.
In the disclosed embodiment, the loss function includes a pixel loss function, a first discrimination loss function, a second discrimination loss function, and an image generation loss function, wherein,
the value of the pixel loss function is determined based on corresponding pixels in the second image and the corresponding generated image in each sample image pair; the value of the first discrimination loss function is determined based on the first discrimination corresponding to the generated image in each sample image pair; the value of the second discrimination loss function is determined based on a second discrimination result corresponding to the second image in each sample image pair; the value of the image generation loss function is determined based on the second image and the corresponding generated image in each sample image pair.
In an embodiment of the present disclosure, when the training module calculates the value of the loss function based on the generated image, the second image, the first determination result, and the second determination result, the training module is specifically configured to:
determining the weight of each function;
and performing weighted fusion on the values of the functions based on the weight of the functions to obtain the value of the loss function.
The image processing apparatus of the embodiment of the present disclosure can execute an image processing method provided by the embodiment of the present disclosure, and the implementation principles thereof are similar, the actions executed by the modules in the image processing apparatus in the embodiments of the present disclosure correspond to the steps in the image processing method in the embodiments of the present disclosure, and for the detailed functional description of the modules in the image processing apparatus, reference may be specifically made to the description in the corresponding image processing method shown in the foregoing, and details are not repeated here.
Based on the same principle as the method shown in the embodiments of the present disclosure, embodiments of the present disclosure also provide an electronic device, which may include but is not limited to: a processor and a memory; a memory for storing computer operating instructions; and the processor is used for executing the method shown in the embodiment by calling the computer operation instruction.
Based on the same principle as the method shown in the embodiment of the present disclosure, an embodiment of the present disclosure further provides a computer-readable storage medium, where at least one instruction, at least one program, a code set, or an instruction set is stored in the computer-readable storage medium, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the method shown in the embodiment, which is not described herein again.
Referring now to FIG. 8, shown is a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device includes: a memory and a processor, wherein the processor may be referred to as the processing device 601 hereinafter, and the memory may include at least one of a Read Only Memory (ROM)602, a Random Access Memory (RAM)603 and a storage device 608 hereinafter, which are specifically shown as follows:
as shown in fig. 8, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 8 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. 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.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the designation of a module or unit does not in some cases constitute a limitation of the unit itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, [ example a1 ] there is provided an image processing method comprising:
acquiring an image to be processed;
performing at least one image processing on an image to be processed through an image generation network to obtain a processed image, wherein the definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in the trained generation type countermeasure network.
A2, according to the method A1, the generation type confrontation network comprises a generation network and a judgment network;
the generative confrontation network is trained by the following modes:
acquiring a training sample set, wherein the training sample set comprises sample image pairs, each sample image pair comprises a first image and a second image, the original image contents of the first image and the second image are the same, and the definition of the first image is smaller than that of the second image;
and training the initial generative confrontation network based on the training sample set until the corresponding loss function meets the set condition.
A3, according to the method of a2, the first image is obtained by:
acquiring a second image;
and carrying out blurring processing on the second image based on a preset image blurring processing method to obtain a first image.
A4, training an initial generative confrontation network based on a training sample set according to the method of A2, comprising:
inputting a first image in each sample image pair into a generation network to obtain a generation image corresponding to the first image;
inputting the second image and the corresponding generated image into a discrimination network to obtain a first discrimination result corresponding to the generated image and a second discrimination result corresponding to the second image;
and calculating the value of the loss function based on the generated image, the second image, the first judgment result and the second judgment result, and training the generative countermeasure network based on the value of the loss function.
A5, according to the method of A4, the loss function includes a pixel loss, a first discrimination loss, a second discrimination loss, and an image generation loss, wherein,
pixel loss is determined based on corresponding pixels in the second image and the corresponding generated image in each sample image pair; the first discrimination loss is determined based on a first discrimination corresponding to the generated image in each sample image pair; the second judgment result loss is determined based on a second judgment result corresponding to the second image in each sample image pair; the image generation loss is determined based on the second image in each sample image pair and the corresponding generated image.
A6, calculating a value of a loss function based on the generated image, the second image, the first discrimination result, and the second discrimination result according to the method of a4, including:
determining the weight of each function;
and performing weighted fusion on the values of the functions based on the weight of the functions to obtain the value of the loss function.
According to one or more embodiments of the present disclosure, [ example B1 ] there is provided an image processing apparatus comprising:
the image acquisition module is used for acquiring an image to be processed;
the image processing module is used for carrying out at least one image processing on the image to be processed through the image generation network to obtain a processed image, and the definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in the trained generation type countermeasure network.
B2, the apparatus according to B1, the generative confrontation network comprising a generative network and a discriminative network; the device comprises a training module, a generation type confrontation network and a generation type confrontation network, wherein the training module is used for training in the following way:
acquiring a training sample set, wherein the training sample set comprises sample image pairs, each sample image pair comprises a first image and a second image, the original image contents of the first image and the second image are the same, and the definition of the first image is smaller than that of the second image;
and training the initial generative confrontation network based on the training sample set until the corresponding loss function meets the set condition.
B3, apparatus according to B2, the first image being obtained by:
acquiring a second image;
and carrying out blurring processing on the second image based on a preset image blurring processing method to obtain a first image.
B4, the apparatus of B2, wherein the training module, when training the initial generative confrontation network based on the training sample set, is specifically configured to:
inputting a first image in each sample image pair into a generation network to obtain a generation image corresponding to the first image;
inputting the second image and the corresponding generated image into a discrimination network to obtain a first discrimination result corresponding to the generated image and a second discrimination result corresponding to the second image;
and calculating the value of the loss function based on the generated image, the second image, the first judgment result and the second judgment result, and training the generative countermeasure network based on the value of the loss function.
B5, according to the method of B4, the loss function includes a pixel loss, a first discrimination loss, a second discrimination loss, and an image generation loss, wherein,
pixel loss is determined based on corresponding pixels in the second image and the corresponding generated image in each sample image pair; the first discrimination loss is determined based on a first discrimination corresponding to the generated image in each sample image pair; the second judgment result loss is determined based on a second judgment result corresponding to the second image in each sample image pair; the image generation loss is determined based on the second image in each sample image pair and the corresponding generated image.
B6, according to the method of B4, the training module, when calculating the value of the loss function based on the generated image, the second image, the first discrimination result, and the second discrimination result, is specifically configured to:
determining the weight of each function;
and performing weighted fusion on the values of the functions based on the weight of the functions to obtain the value of the loss function.
According to one or more embodiments of the present disclosure, [ example C1 ] there is provided an electronic device comprising:
a processor and a memory;
a memory for storing computer operating instructions;
a processor for executing the method of any one of A1-A6 by calling computer operation instructions.
According to one or more embodiments of the present disclosure, [ example D1 ] there is provided a computer readable medium having stored thereon at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement the method of any one of a1 to a 6.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (9)

1. An image processing method, comprising:
acquiring an image to be processed;
performing at least one image processing on the image to be processed through an image generation network to obtain a processed image, wherein the definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in a trained generation type countermeasure network; the generative confrontation network is obtained by training an initial generative confrontation network based on a training sample set until a corresponding loss function meets a set condition, wherein the training sample set comprises sample image pairs, each sample image pair comprises a first image and a second image, and the definition of the first image is smaller than that of the second image;
the loss function comprises a pixel loss function, a first discrimination result loss function, a second discrimination result loss function and an image generation loss function;
the value of the pixel loss function is determined based on corresponding pixels in the second image and the corresponding generated image in each sample image pair; the value of the first discrimination loss function is determined based on a first discrimination corresponding to the generated image corresponding to each sample image pair; the value of the second discrimination loss function is determined based on a second discrimination corresponding to a second image in each sample image pair; the value of the image generation loss function is determined based on the second image and the corresponding generated image in each sample image pair.
2. The method of claim 1, wherein the generative confrontation network is trained by:
acquiring the training sample set, wherein each sample image in the training sample set comprises the same original image content of the first image and the second image;
and training the initial generative confrontation network based on the training sample set until the corresponding loss function meets the set condition.
3. The method of claim 2, wherein the first image is obtained by:
acquiring the second image;
and carrying out blurring processing on the second image based on a preset image blurring processing method to obtain the first image.
4. The method of claim 2, wherein training the initial generative confrontation network based on the set of training samples comprises:
inputting the first image in each sample image pair to the generation network to obtain the generation image corresponding to the first image;
inputting the second image and the corresponding generated image into the discrimination network to obtain the first discrimination result corresponding to the generated image and the second discrimination result corresponding to the second image;
calculating a value of the loss function based on the generated image, the second image, the first discrimination result, and the second discrimination result, and training the generative countermeasure network based on the value of the loss function.
5. The method of claim 4, wherein the calculating the value of the loss function based on the generated image, the second image, the first discrimination result, and the second discrimination result comprises:
determining the weight of each function;
and performing weighted fusion on the values of the functions based on the weight of the functions to obtain the value of the loss function.
6. An image processing apparatus characterized by comprising:
the image acquisition module is used for acquiring an image to be processed;
the image processing module is used for carrying out at least one-time image processing on the image to be processed through an image generation network to obtain a processed image, and the definition of the processed image is higher than that of the image to be processed;
the image generation network is a generation network in a trained generation type countermeasure network; the generative confrontation network is obtained by training an initial generative confrontation network based on a training sample set until a corresponding loss function meets a set condition, wherein the training sample set comprises sample image pairs, each sample image pair comprises a first image and a second image, and the definition of the first image is smaller than that of the second image;
the loss function comprises a pixel loss function, a first discrimination result loss function, a second discrimination result loss function and an image generation loss function;
the value of the pixel loss function is determined based on corresponding pixels in the second image and the corresponding generated image in each sample image pair; the value of the first discrimination loss function is determined based on a first discrimination corresponding to the generated image corresponding to each sample image pair; the value of the second discrimination loss function is determined based on a second discrimination corresponding to a second image in each sample image pair; the value of the image generation loss function is determined based on the second image and the corresponding generated image in each sample image pair.
7. The apparatus of claim 6, wherein the apparatus comprises a training module for training the generative confrontation network by:
acquiring a training sample set, wherein each sample image in the training sample set has the same original image content of the first image and the second image;
and training the initial generative confrontation network based on the training sample set until the corresponding loss function meets the set condition.
8. An electronic device, comprising:
a processor and a memory;
the memory is used for storing computer operation instructions;
the processor is used for executing the method of any one of claims 1 to 5 by calling the computer operation instruction.
9. A computer readable medium storing at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the method of any of claims 1 to 5.
CN202010177472.XA 2020-03-13 2020-03-13 Image processing method, image processing device, electronic equipment and computer readable medium Active CN111402159B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010177472.XA CN111402159B (en) 2020-03-13 2020-03-13 Image processing method, image processing device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010177472.XA CN111402159B (en) 2020-03-13 2020-03-13 Image processing method, image processing device, electronic equipment and computer readable medium

Publications (2)

Publication Number Publication Date
CN111402159A CN111402159A (en) 2020-07-10
CN111402159B true CN111402159B (en) 2021-05-18

Family

ID=71430845

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010177472.XA Active CN111402159B (en) 2020-03-13 2020-03-13 Image processing method, image processing device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN111402159B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112488947A (en) * 2020-12-04 2021-03-12 北京字跳网络技术有限公司 Model training and image processing method, device, equipment and computer readable medium
CN113160156A (en) * 2021-04-12 2021-07-23 佛山市顺德区美的洗涤电器制造有限公司 Method for processing image, processor, household appliance and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110223245A (en) * 2019-05-16 2019-09-10 华南理工大学 Blurred picture clearness processing method and system based on deep neural network
CN110223254A (en) * 2019-06-10 2019-09-10 大连民族大学 A kind of image de-noising method generating network based on confrontation
CN110570358A (en) * 2018-09-04 2019-12-13 阿里巴巴集团控股有限公司 vehicle loss image enhancement method and device based on GAN network
CN110660025A (en) * 2019-08-02 2020-01-07 西安理工大学 Industrial monitoring video image sharpening method based on GAN network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110570358A (en) * 2018-09-04 2019-12-13 阿里巴巴集团控股有限公司 vehicle loss image enhancement method and device based on GAN network
CN110223245A (en) * 2019-05-16 2019-09-10 华南理工大学 Blurred picture clearness processing method and system based on deep neural network
CN110223254A (en) * 2019-06-10 2019-09-10 大连民族大学 A kind of image de-noising method generating network based on confrontation
CN110660025A (en) * 2019-08-02 2020-01-07 西安理工大学 Industrial monitoring video image sharpening method based on GAN network

Also Published As

Publication number Publication date
CN111402159A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
CN110413812B (en) Neural network model training method and device, electronic equipment and storage medium
CN111402112A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN111368685A (en) Key point identification method and device, readable medium and electronic equipment
US20240013359A1 (en) Image processing method, model training method, apparatus, medium and device
CN111080595A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN111402159B (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN110705511A (en) Blurred image recognition method, device, equipment and storage medium
CN111402113B (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN111402151A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN112418249A (en) Mask image generation method and device, electronic equipment and computer readable medium
CN112419179A (en) Method, device, equipment and computer readable medium for repairing image
CN114494071A (en) Image processing method, device, equipment and storage medium
CN113038176B (en) Video frame extraction method and device and electronic equipment
CN110719407A (en) Picture beautifying method, device, equipment and storage medium
CN111757100B (en) Method and device for determining camera motion variation, electronic equipment and medium
WO2024016923A1 (en) Method and apparatus for generating special effect graph, and device and storage medium
CN110399802B (en) Method, apparatus, medium, and electronic device for processing eye brightness of face image
CN110765304A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN111402133A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN111369429B (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN114972021A (en) Image processing method and device, electronic equipment and storage medium
CN114419298A (en) Virtual object generation method, device, equipment and storage medium
CN111369468B (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN111737575B (en) Content distribution method, content distribution device, readable medium and electronic equipment
CN114399696A (en) Target detection method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: Tiktok vision (Beijing) Co.,Ltd.

CP01 Change in the name or title of a patent holder